fuzzyclust.ensemble.evidence_accumulation#
- fuzzyclust.ensemble.evidence_accumulation(S, n_clusters=None, method='average', max_clusters=20)[source]#
Evidence accumulation clustering of a co-association matrix (Fred and Jain, 2005).
The co-association \(s_{kl}\) is turned into the distance \(1-s_{kl}\) and clustered hierarchically; the dendrogram is cut into
n_clustersgroups, or – whenn_clustersisNone– at the number of clusters with the longest lifetime, the range of thresholds over which that number of clusters persists.- Parameters:
- Sarray_like
ofshape(n_samples,n_samples) - n_clusters
intorNone, default=None - method{“average”, “single”, “complete”, “ward”}, default=”average”
Linkage of
scipy.cluster.hierarchy.linkage()(the paper uses single and average link).- max_clusters
int, default=20 Largest number of clusters considered by the lifetime criterion.
- Sarray_like
- Returns:
Examples
>>> import numpy as np >>> from fuzzyclust.ensemble import coassociation_matrix, evidence_accumulation >>> U = np.eye(2)[[0, 0, 0, 1, 1, 1]] >>> labels, Z, life = evidence_accumulation(coassociation_matrix([U])) >>> int(labels[0] != labels[-1]), int(np.argmax(life) + 1) (1, 2)