fuzzyclust.graph.fuzzy_cluster_similarity#

fuzzyclust.graph.fuzzy_cluster_similarity(U)[source]#

Pairwise similarity of fuzzy clusters seen as fuzzy sets over the samples.

\[S_{ij} = \frac{\sum_{k=1}^{N}\min(\mu_{ik},\mu_{jk})}{\sum_{k=1}^{N}\max(\mu_{ik},\mu_{jk})} = \frac{|A_i\cap A_j|}{|A_i\cup A_j|},\]

the Jaccard-type ratio of the fuzzy intersection and union (Vathy-Fogarassy, Feil and Abonyi, 2005, eq. 11). Two clusters that share many samples with comparable memberships are similar and are candidates for merging; the matrix can be fed to a hierarchical clustering of the clusters (plot_similarity_dendrogram()).

Parameters:
Uarray_like of shape (n_samples, n_clusters)

Fuzzy partition (membership_ of a fitted estimator).

Returns:
Sndarray of shape (n_clusters, n_clusters)

Symmetric, ones on the diagonal.

Examples

>>> import numpy as np
>>> from fuzzyclust.graph import fuzzy_cluster_similarity
>>> U = np.array([[0.9, 0.1, 0.0], [0.6, 0.4, 0.0], [0.0, 0.0, 1.0]])
>>> np.round(fuzzy_cluster_similarity(U), 3)
array([[1.   , 0.333, 0.   ],
       [0.333, 1.   , 0.   ],
       [0.   , 0.   , 1.   ]])