fuzzyclust.ensemble.information_theoretic_kmeans#

fuzzyclust.ensemble.information_theoretic_kmeans(memberships, n_clusters, max_iter=100, n_init=10, random_state=None)[source]#

Information-theoretic k-means consensus, ITK (Punera and Ghosh, 2008).

The concatenated membership vectors of an object, divided by the number of partitions, form a probability distribution \(\mathbf{p}_k\) over all clusters of the library. ITK is k-means with the Kullback–Leibler divergence \(\mathrm{KL}(\mathbf{p}_k\|\mathbf{m}_i)\) as distortion, whose centroids \(\mathbf{m}_i\) are the arithmetic means of the assigned distributions. Like k-means it finds local optima; n_init k-means++ seedings (with the KL divergence) are run and the one with the smallest total divergence is kept.

Parameters:
membershipssequence of array_like of shape (n_samples, c_q)
n_clustersint
max_iterint, default=100
n_initint, default=10
random_stateint, RandomState instance or None
Returns:
labelsndarray of shape (n_samples,)
centroidsndarray of shape (n_clusters, sum of c_q)

Examples

>>> import numpy as np
>>> from fuzzyclust.ensemble import information_theoretic_kmeans
>>> U = np.eye(2)[[0, 0, 0, 1, 1, 1]]
>>> labels, _ = information_theoretic_kmeans([U, U[:, ::-1]], 2, random_state=0)
>>> int(labels[0] != labels[-1])
1