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_initk-means++ seedings (with the KL divergence) are run and the one with the smallest total divergence is kept.- Parameters:
- membershipssequence
ofarray_likeofshape(n_samples,c_q) - n_clusters
int - max_iter
int, default=100 - n_init
int, default=10 - random_state
int,RandomStateinstanceorNone
- membershipssequence
- Returns:
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