Chapter 12
Beyond a single unsupervised run: partial supervision,
co-clustering, collaboration, and ensembles
All algorithms so far take one data matrix, cluster its rows without outside knowledge, and return the partition of one run. This chapter relaxes each of these restrictions. Partial supervision lets a few class labels (Pedrycz and Waletzky) or a few must-link and cannot-link pairs (Grira, Crucianu, and Boujemaa) steer the partition toward the structure the user means; co-clustering (FCCM of Oh, Honda, and Ichihashi; Fuzzy CoDoK of Kummamuru, Dhawale, and Krishnapuram) clusters the rows and the columns of an object–item matrix at once; collaborative clustering (Pedrycz) reconciles the partitions of several data sites that describe the same objects without exchanging their data; and cluster ensembles (Strehl and Ghosh, Punera and Ghosh, and Fred and Jain) combine a library of runs into a consensus that is typically more accurate than its members and more reproducible than a single run, and they read the number of clusters off the agreement of the runs. Partial supervision and collaboration add a term to the c-means functional of chapter 3, co-clustering replaces it by an aggregation criterion, and ensembles combine its results; the methods live in fuzzyclust.semisupervised, .coclustering, .collaborative, and .ensemble.
12.1 Problem and idea
Fuzzy c-means finds the partition that the distance and the prototype shape make optimal, and that partition is not always the one the user wants. Two long parallel bars of points are a simple example (fig. 12.1): with two spherical prototypes the c-means functional prefers a split across the bars, because the variance along the bars dominates the gap between them, whereas the user knows that the bars are the classes. Pedrycz and Waletzky [165] observed that the user often knows the class of a few samples, and added to the functional a term that penalizes the difference between the memberships of these labeled samples and their labels. Since the labeled and the unlabeled samples share the prototypes, a handful of labels moves the prototypes and rotates the whole partition. Labels presuppose an agreed list of classes; a weaker and often cheaper kind of knowledge says only that two samples belong together (must-link) or not (cannot-link): two images show the same scene, two records describe the same customer. Grira, Crucianu, and Boujemaa [166] penalize the expected number of violated pairs and combine the penalty with the competitive agglomeration of Frigui and Krishnapuram [167], which lets an overestimated number of clusters shrink to the number the data and the constraints support.
A second limitation is the data matrix itself. For a document–term matrix, a user–product table, or any other non-negative co-occurrence matrix, the rows and the columns are both entities worth clustering, and a cluster is a pair: a group of documents and the vocabulary that makes them a group (fig. 12.2). Clustering the rows with a distance between sparse count vectors misses this duality. Oh, Honda, and Ichihashi [168] give each co-cluster two membership vectors, one over the objects and one over the items, and maximize the aggregation of the matrix entries that both memberships select; Kummamuru, Dhawale, and Krishnapuram [169] solve the same problem with a different regularizer that scales to large document collections.
The third limitation is organizational. The same objects—patients, customers, production batches—are often described at several data sites by different features, and the raw data cannot be pooled for reasons of confidentiality, size, or ownership. Pedrycz’s collaborative clustering [170] runs fuzzy c-means at every site and lets the sites exchange only their partition matrices (fig. 12.3): each site re-clusters its own data with an additional term that pulls its memberships toward those of the other sites, weighted by a collaboration matrix. The structures are reconciled without moving any data, and how far each site has to move tells how much it disagrees with the rest.
The last limitation is the single run. An alternating-optimization clusterer
finds a local optimum that depends on its start, and the partition depends on the
sample and on the features it saw; restarts (n_init) keep the run with the
lowest objective but discard the information in the others. A cluster
ensemble [171] keeps all of them (fig. 12.4). A library of partitions is
generated by random starts, sub-samples, feature subsets, or different
numbers of clusters. It is summarized by the co-association matrix, the
average similarity of the membership vectors of two objects, which needs no
matching of cluster labels between the members, and a consensus function
partitions the objects from this matrix. Punera and Ghosh [172] showed how
to use the soft partitions directly instead of hardening them first. Fred
and Jain [173] used the co-association matrix to choose the number of
clusters: when the members over-segment the data, the natural groups
form the partition of its dendrogram that survives the widest range of
thresholds.
12.2 Theory
The notation is that of the book: with rows , memberships in (stored transposed in the code), prototypes , squared Euclidean distances , index or for clusters and or for samples. The starting point is fuzzy c-means with : the functional (3.3), its membership formula (3.6), and its prototype update (3.7). The supervised and the collaborative algorithms add a quadratic term to and keep , the value for which their papers derive closed-form updates. We treat partial supervision by labels (section 12.2.1) and by pairs (section 12.2.2), co-clustering (section 12.2.3), collaboration (section 12.2.4), and ensembles (sections 12.2.5 and 12.2.6).
12.2.1 Fuzzy c-means with partial supervision
Let indicate whether sample is labeled and let , , be its label—the indicator of its class or, more generally, a fuzzy label vector; class is tied to cluster , and surplus clusters are unsupervised. Pedrycz and Waletzky [165] minimize
|
| (12.1) |
under . The second term measures, in the metric of the clustering, how far the memberships of the labeled samples are from their labels; for an unlabeled sample it reads and merely rescales the c-means term. Setting the derivative of the Lagrangian to zero gives
|
| (12.2) |
which is the FCM membership for an unlabeled sample and, for a labeled one, the convex combination : the label is followed to the degree . The prototypes are weighted means with the weights of both terms,
|
| (12.3) |
The influence of the labels on the prototypes is not monotone in . For a labeled sample whose membership has reached its label, the supervision weight vanishes, while every unlabeled sample carries the weight ; a very large therefore clamps the labeled memberships but lets the unlabeled majority outweigh them in (12.3). The paper recommends proportional to , the ratio of all samples to the labeled ones, so that the labeled minority is not ignored; the examples show that moderate values, , move the partition most. Because class is tied to cluster , a random start that places cluster next to the samples of another class makes the supervision fight the geometry; starting every supervised prototype at the mean of its labeled samples avoids this. New samples carry no label and receive FCM memberships to the supervised prototypes.
In a nutshell: Fuzzy c-means with partial supervision
- Adds to the c-means functional the distance-weighted squared difference between the memberships of the labeled samples and their labels; the labels act on the whole partition through the shared prototypes.
- Labeled memberships are convex combinations of the FCM membership and the label, with weight on the label; unlabeled samples keep the FCM formula.
- Parameters: the weight (moderate values move the partition most; is the paper’s rule), the number of clusters (at least the number of classes), and the start (at the labeled means).
- Use when a few samples of every class are known and the unsupervised optimum differs from the classes; .
12.2.2 Pairwise constraints and competitive agglomeration
Let be the set of must-link and the set of cannot-link pairs . Under memberships , the degree to which a must-link pair is separated is and the degree to which a cannot-link pair is together is ; summed over all pairs, these degrees give the expected number of violated constraints when every sample is assigned at random according to its memberships. Grira, Crucianu, and Boujemaa [166] minimize, with the fuzzy cardinalities ,
|
| (12.4) |
The last term is the competitive agglomeration bias of Frigui and Krishnapuram [167]: it rewards large clusters, so the clusters compete for samples and those that lose them can be discarded. Let be the cost of placing sample in cluster : the expected number of constraints it would violate there, given the current memberships of its partners. The Lagrange conditions, solved with the cross terms held at their previous values, give the FCM membership plus two corrections,
|
| (12.5) |
where and are the means of and over the clusters, weighted by . A cluster in which violates fewer constraints than on average gains membership, and with a cluster larger than average gains membership. The corrections are weighted by and cancel for a sample that is much closer to one prototype than to the others, so the constraints act most strongly on the ambiguous samples near the cluster boundaries. Negative values are clipped and the memberships renormalized, as in competitive agglomeration. The penalty is in the units of the squared distances. Grira et al. renew it at every iteration so that the constraint term is commensurate with the data term: the mean membership-weighted squared distance, scaled by the ratio of samples to constraints,
The automatic rule of fuzzyclust omits the normalization by and uses , the published value times ; the two agree for a crisp partition. The agglomeration weight follows the schedule of competitive agglomeration,
|
| (12.6) |
strong at the start and decaying with the iteration , and clusters whose cardinality falls below a minimum are removed. The prototypes are the FCM means (3.7).
In a nutshell: Pairwise-constrained competitive agglomeration
- Penalizes the expected number of violated must-link and cannot-link pairs; the membership update shifts membership toward the clusters in which a sample violates fewer constraints.
- Pairs need no list of classes and are cheap to collect; fewer pairs need a larger penalty, and a few pairs may be satisfied by bending the boundary locally.
- Optional competitive agglomeration: start with too many clusters, let them compete, and discard the small ones; the usable window of lies between “no competition” and “one cluster takes all”.
- Parameters: (or the automatic rule), , , minimal cardinality; .
12.2.3 Fuzzy co-clustering of objects and items
Let be an object–item matrix (counts, frequencies, TF-IDF weights). A co-cluster has object memberships and item memberships , with the constraints for every object (an object is shared among the co-clusters, as in FCM) and for every co-cluster (each co-cluster distributes one unit of membership over the items). The quantity to be maximized is the aggregation degree
|
| (12.7) |
large when the objects of a co-cluster cooccur with its items. The aggregation is a weighted mean of the row of object over the items of co-cluster , and is a weighted sum of the column of item over the objects of the co-cluster. The aggregation degree alone is linear in each membership set and is maximized by crisp, degenerate memberships, with the whole item membership of a co-cluster on its single most frequent item. Oh, Honda, and Ichihashi [168] regularize both sets by their entropies, the device of Miyamoto and Mukaidono for fuzzy c-means [23], and maximize
|
| (12.8) |
The necessary conditions are soft-max assignments,
|
| (12.9) |
alternated until the object memberships settle. The weights are measured in the units of the aggregations they temper: like a typical entry of , and like an entry summed over the objects of a co-cluster, so its scale grows with the size of the data. A small makes the corresponding memberships crisp; a large one drives them to the uniform values and . New objects receive memberships by the first formula with the fitted item memberships.
In a nutshell: FCCM
- Clusters rows and columns of a non-negative co-occurrence matrix at once; a co-cluster is a group of objects with the items that characterize it.
- Maximizes the aggregation degree regularized by the entropies of both membership sets; the updates are soft-max assignments, and no distance between rows is needed.
- Parameters: (in the units of a row mean) and (in the units of a column sum over a co-cluster); outside a window of the solution degenerates.
- Use for document–term, user–item, or other count tables; restarts
(
n_init) keep the largest objective.
Kummamuru, Dhawale, and Krishnapuram [169] replace the entropies by quadratic regularizers,
|
| (12.10) |
The necessary conditions are then linear: a membership is the uniform value plus a multiple of the deviation of its aggregation from the mean aggregation,
|
| (12.11) |
followed by clipping at zero and renormalization. No exponentials are evaluated, which removes the overflow of (12.9) for large aggregations, and the clipping sets the item memberships of the irrelevant terms to exactly zero, which gives a sparse and readable result for document collections with large vocabularies.
In a nutshell: Fuzzy CoDoK
- The FCCM aggregation with quadratic instead of entropy regularizers: linear updates, clipping instead of exponentials.
- Sparse item memberships (irrelevant items get zero), no overflow for large aggregations, and a wider usable range of the item weight .
- Parameters: and in the units of FCCM’s and .
12.2.4 Collaborative fuzzy clustering
The same objects are described at sites by data , . All sites look for clusters, with memberships , prototypes in their own feature spaces, and squared distances . The collaboration matrix states how strongly site takes the partition of site into account. Pedrycz [170] lets site minimize
|
| (12.12) |
in which the other sites enter only through their memberships. With and the communicated memberships
|
| (12.13) |
the Lagrange conditions give
The membership is a convex combination of the other sites’ memberships, with total weight , and of the site’s own FCM membership; the prototype weights add to the FCM weight the disagreement with the other sites. The algorithm has two phases. In the first, every site runs FCM independently, and the clusters of the sites are matched by the Hungarian algorithm on the membership overlap , because the sites must refer to the same clusters. In the second, the sites iterate synchronously: each updates its prototypes and memberships by (12.14) and (12.15) from the partitions the others communicated in the previous round, until no membership changes by more than . A site whose row of the collaboration matrix is zero keeps minimizing its plain FCM functional in the second phase, so it stays at its phase-one solution up to the tolerance of the first phase. The collaboration matrix need not be symmetric: a site may listen without being listened to.
Two quantities summarize the result. The distance between the partitions of two sites, , or their fuzzy Rand index (4.19), measures how well the sites agree; the mean absolute change of a site’s memberships from the first to the second phase measures how much the site had to give in, and therefore how much its view of the objects differed from the others’.
In a nutshell: Collaborative fuzzy clustering
- The same objects are described at several sites by different features; the sites exchange only partition matrices, never data.
- Each site minimizes its FCM functional plus the distance-weighted disagreement with the other sites’ memberships; memberships become convex combinations of own and communicated memberships.
- The collaboration matrix sets how much site trusts site and may be asymmetric; a larger weight pulls the partitions together monotonically.
- The membership change of a site from the independent to the collaborative phase locates the sites that disagree; .
12.2.5 Cluster ensembles and consensus functions
Consider a library of soft partitions of the same objects; member has clusters and membership vectors . In fuzzyclust the ensemble generates the library itself: every member is the base clusterer (fuzzy c-means by default), fitted with its own random start on a random share of the samples and of the features and with a number of clusters drawn from a given set, and the memberships of all samples come from its predict_proba. Strehl and Ghosh [171] call the task of combining such partitions without access to the data knowledge reuse; the members’ cluster labels are arbitrary, so a consensus function must be invariant to them.
The co-association matrix. Comparing objects rather than clusters makes the labels irrelevant. The soft co-association of two objects is the library average of the similarity of their membership vectors,
|
| (12.16) |
For crisp members both equal the fraction of members that put and into the same cluster, which is the evidence accumulation matrix of Fred and Jain [173] and the similarity of the CSPA algorithm of Strehl and Ghosh. For soft members the inner product (right) is the probability that two independent draws from the membership vectors land in the same cluster; it is below one even for , and the more so the fuzzier the member. The cosine (left, the default) normalizes the membership vectors of every member, so that an object is fully co-associated with itself and with every object that has the same membership vector; the scale of then does not depend on the fuzziness or the number of clusters of the members. The matrix is symmetric with entries in .
Consensus functions. Five ways to obtain consensus clusters are implemented. (i) FCM on the rows of : the row is the profile of object ’s co-associations with all objects, and objects of one consensus cluster have similar profiles; fuzzy c-means with clusters these -dimensional rows. In such a high dimension FCM from a random partition drifts to the trivial fixed point of all prototypes at the grand mean, so the prototypes are seeded with k-means++. (ii) Spectral partitioning [174] of the graph with adjacency ; it takes the place of the METIS partitioner [175] used in CSPA and in the soft sCSPA of Punera and Ghosh [172]. (iii) Hierarchical clustering of the distance (evidence accumulation, section 12.2.6). (iv) The soft meta-clustering algorithm sMCLA [172]: every cluster of every member is a hyperedge, its membership vector over the objects; the hyperedges are grouped into meta-clusters by the similarity of these vectors (fuzzyclust uses their cosine similarity and spectral partitioning in place of METIS), every meta-cluster is collapsed into its mean membership vector, and an object’s consensus membership is its collapsed membership normalized over the meta-clusters. (v) Information-theoretic k-means ITK [172]: the concatenated membership vectors of an object, divided by , form a distribution over all clusters of the library, and k-means with the Kullback–Leibler divergence as distortion partitions these distributions; its centroids are arithmetic means, and restarts keep the smallest total divergence. The hard consensus functions (ii), (iii), and (v) receive soft memberships in the space of the co-associations: the mean row of every consensus cluster is its prototype , and every object receives the FCM membership of its row,
|
| (12.17) |
the same rule as for (i), so that all consensus memberships are on one scale. A new object is passed through every member, its co-associations with the training objects follow from (12.16), and (12.17) (or the meta-clusters of sMCLA) gives its consensus membership. The classical hard consensus functions CSPA and MCLA of Strehl and Ghosh are (ii) and (iv) applied to crisp members.
In a nutshell: Fuzzy cluster ensemble
- Combines a library of soft partitions (random starts, sub-samples, feature subsets, various ) through the co-association matrix, which needs no matching of cluster labels.
- The consensus is typically better than the average member and far more reproducible than a single run; most of the gain comes with the first few members.
- Parameters: library size, sample and feature fractions, member cluster numbers, consensus function (FCM on the rows of , spectral, hierarchical, sMCLA, ITK), similarity (cosine or inner product).
- Costs fits plus an matrix; use for unstable clusterers, weak views of the data, or to choose (next section).
12.2.6 Evidence accumulation and the lifetime criterion
Fred and Jain [173] use the co-association matrix of members that deliberately over-segment the data: k-means runs with many more clusters than expected and a different number for each run. Objects of one natural group are split differently by different members but stay together in most of them; objects of different groups are rarely together. The distance is clustered hierarchically (single or average link); let be the merge heights of the dendrogram and the largest possible distance. Cutting the dendrogram at a threshold in yields exactly clusters, and the length of this interval,
|
| (12.18) |
is the lifetime of the -cluster partition. The chosen number of clusters is the one of longest lifetime, the partition least sensitive to the choice of the threshold. The criterion inherits the behavior of the linkage. Average link copes with soft members; single link merges two groups as soon as one chain of objects connects them, and since the co-associations of soft members between neighboring groups never vanish, the one-cluster partition then lives longest. The members must also over-segment: a member with fewer clusters than groups merges some groups, and no amount of evidence separates what no member separates.
In a nutshell: Evidence accumulation
- The chosen number of clusters is that of the partition of the co-association dendrogram that persists over the widest range of thresholds.
- Needs over-segmenting members; beyond that, the exact range of member cluster numbers hardly matters.
- Average link works with soft members; single link can be defeated by chains of intermediate objects.
- Parameters: range of member cluster numbers, linkage, largest considered.
12.3 Using it in fuzzyclust
The four sub-packages follow the conventions of the toolbox. The supervised estimators derive from BaseFuzzyClusterer and take the supervision as arguments of fit; the co-clustering estimators and the ensemble are scikit-learn clusterers with fit(X); the collaborative estimator takes a list of data sites. All accept pandas input and have a random_state, and their partitions can be compared with the fuzzy Rand indices of fuzzyclust.validity (section 4.2.8).
fuzzyclust.semisupervised.SemiSupervisedFCM
n_clusters=3, alpha=1.0|"auto"
(),
m=2.0 (fixed), tol, max_iter, init="labels"|"random"|"kmeans++"|array,
n_init, random_state, verbose.
fit(X, y) with y a label vector (-1 = unlabeled) or a label-membership matrix
whose zero rows mark the unlabeled samples. Attributes membership_,
cluster_centers_, labels_, classes_, label_mapping_ (class of every
cluster, -1 for unsupervised ones), labelled_mask_, label_membership_,
alpha_, covariances_; methods predict_classes(X), score_labels(X,
y).
fuzzyclust.semisupervised.PairwiseConstrainedFCM
n_clusters=3, alpha=1.0|"auto", agglomeration=0.0
(),
agglomeration_decay=10.0 (),
min_cardinality=1.0, m=2.0 (fixed), tol, max_iter, init, n_init,
random_state, verbose.
fit(X, must_link=pairs, cannot_link=pairs). Attributes n_clusters_,
membership_, cluster_centers_, must_link_, cannot_link_,
must_link_satisfied_, cannot_link_satisfied_, alpha_, cardinalities_.
Utilities constraint_satisfaction(labels, must_link, cannot_link),
check_pairwise_constraints; generators make_partially_labeled_pair,
make_partial_labels, make_pairwise_constraints; plots plot_label_propagation,
plot_pairwise_constraints.
fuzzyclust.coclustering.FCCM, FCoDoK
n_clusters=3, lambda_u=1.0 (
or ),
lambda_w=1.0 (
or ),
tol, max_iter, init="random"|"kmeans++"|array, n_init (largest objective
kept), random_state, verbose.
fit(R) with a non-negative matrix. Attributes membership_
, item_membership_
, labels_,
item_labels_, aggregation_, objective_, objective_history_; transform returns the
aggregations ,
predict_proba the object memberships of new rows. Generator make_block_matrix;
plots plot_coclusters (reordered heat map), plot_item_memberships.
fuzzyclust.collaborative.CollaborativeFCM
n_clusters=3, alpha=0.5 (scalar or
matrix), m=2.0 (fixed), tol, max_iter, init, n_init, random_state,
verbose.
fit([X_1, ..., X_P]). Attributes (lists over the sites) memberships_,
cluster_centers_, labels_, independent_memberships_, independent_centers_;
arrays alpha_, objective_, objective_history_, partition_distances_,
collaboration_change_, consensus_membership_. Methods predict_proba,
predict, transform on lists of sites, site_agreement(index=fuzzy_rand_index).
Utility align_partitions; generator make_collaborative_sites; plots
plot_site_partitions, plot_collaboration_trajectory.
fuzzyclust.ensemble.FuzzyClusterEnsemble
n_clusters=3|None (lifetime criterion), base_estimator=None (FCM; any
clusterer with predict_proba), n_estimators=10, base_n_clusters=None|int|
sequence, sample_fraction=1.0, feature_fraction=1.0, consensus="fcm"|
"spectral"|"hierarchical"|"smcla"|"itk", linkage="average"|
"single"|"complete", similarity="cosine"|"product", max_clusters=20,
random_state, verbose.
Attributes base_estimators_, base_memberships_, base_feature_subsets_,
coassociation_, consensus_membership_ (= membership_), labels_, n_clusters_,
consensus_centers_, lifetimes_, linkage_, meta_cluster_labels_,
base_agreement_. Functions coassociation_matrix, evidence_accumulation,
soft_mcla, information_theoretic_kmeans, cspa, mcla, stability_curve(X,
n_estimators_grid, n_repeats, index); generator make_overlapping_blobs;
plots plot_coassociation, plot_lifetimes.
Partial labels and pairwise constraints are passed to fit:
fcm = FCM(n_clusters=2, random_state=0).fit(X) ssfcm = SemiSupervisedFCM(n_clusters=2, alpha=1.0, random_state=0).fit(X, y_partial) print(f"FCM ARI = {adjusted_rand_score(y, fcm.labels_):.2f}, " f"SSFCM ARI = {adjusted_rand_score(y, ssfcm.labels_):.2f}, " f"accuracy of the class prediction = {ssfcm.score_labels(X, y):.2f}")
must_link, cannot_link = make_pairwise_constraints(y, n_must_link=50, n_cannot_link=50, random_state=0) fcm = FCM(n_clusters=2, random_state=0).fit(X) pcca = PairwiseConstrainedFCM(n_clusters=2, alpha=5.0, random_state=0) pcca.fit(X, must_link=must_link, cannot_link=cannot_link) print(f"FCM ARI = {adjusted_rand_score(y, fcm.labels_):.2f}") print(f"PCCA ARI = {adjusted_rand_score(y, pcca.labels_):.2f}, satisfied must-link " f"{pcca.must_link_satisfied_:.2f}, cannot-link {pcca.cannot_link_satisfied_:.2f}")
A co-clustering returns memberships for the rows and for the columns:
fccm = FCCM(n_clusters=4, lambda_u=0.1, lambda_w=20.0, n_init=5, random_state=0).fit(R) print(f"FCCM documents ARI = {adjusted_rand_score(doc_topic, fccm.labels_):.2f}, " f"topical terms ARI = {adjusted_rand_score(term_topic[topical], fccm.item_labels_[topical]):.2f}")
The collaborative estimator takes the sites as a list and reports how much every site moved:
independent = CollaborativeFCM(n_clusters=3, alpha=0.0, random_state=0).fit(Xs) collab = CollaborativeFCM(n_clusters=3, alpha=3.0, random_state=0).fit(Xs) for name, model in (("independent", independent), ("alpha = 3", collab)): print(f"{name:12s}: ARI per site = " + ", ".join(f"{adjusted_rand_score(y, lab):.2f}" for lab in model.labels_) + f"; membership change = {np.round(model.collaboration_change_, 3)}")
An ensemble is configured by its library and its consensus function; with
n_clusters=None it chooses the number of clusters, and stability_curve
measures its reproducibility:
ens = FuzzyClusterEnsemble(n_clusters=4, n_estimators=20, sample_fraction=0.3, feature_fraction=0.34, consensus="fcm", random_state=0).fit(X) members = [adjusted_rand_score(y, U.argmax(axis=1)) for U in ens.base_memberships_] print(f"members: mean ARI = {np.mean(members):.2f}, best = {np.max(members):.2f}; " f"consensus ARI = {adjusted_rand_score(y, ens.labels_):.2f}")
ens = FuzzyClusterEnsemble(n_clusters=None, base_n_clusters=range(6, 13), n_estimators=30, linkage="average", random_state=0).fit(X) print(f"lifetime criterion: {ens.n_clusters_} clusters, ARI = {adjusted_rand_score(y, ens.labels_):.2f}") print("lifetimes of k = 1..8:", np.round(ens.lifetimes_[:8], 3))
table = stability_curve(X10, n_estimators_grid=(1, 3, 10, 20), n_repeats=5, n_clusters=10, random_state=0, index=fuzzy_adjusted_rand_index) print(table.round(3))
12.4 Examples
12.4.1 How many labels, how much weight?
The two parallel bars of 150 points each (fig. 12.5) are split by FCM across the bars (ARI ). With 10 % labeled samples and the prototypes move toward the bars and the ARI rises to ; of all samples are assigned to their class. Plotted against the position along the bars (fig. 12.6), the memberships are clear in the middle of the bars and drift toward at their ends, where both prototypes are almost equally far away. At the ends spherical prototypes cannot tell the bars apart, and that is where the remaining errors lie. The study of fig. 12.7 varies the label fraction from 1 to 30 % and the weight. Up to more labels always help (: from at 1 % to at 30 %), while the weight acts non-monotonically: never exceeds , and the paper’s rule , which gives a large weight when labels are scarce, does no better than up to 10 % labels and approaches only at 30 % (). The reason is the weighting in (12.3): once the labeled memberships match their labels, their supervision weight vanishes, while the unlabeled samples are weighted by .
Open in ColabExample plot_01_ssfcm_partial_labels.py in the gallery
12.4.2 Must-link, cannot-link, and competitive agglomeration
On the same bars, 50 must-link and 50 cannot-link pairs drawn from the classes are given (fig. 12.8). FCM violates 24 of them; PCCA with satisfies all and reaches an ARI of . The penalty study (fig. 12.9) shows that the fewer the pairs, the larger the penalty needed: 100 pairs of each kind reach an ARI of at , 25 pairs need , and 10 pairs reach only even at , although nine tenths of them are satisfied already at , because a handful of pairs can be honored by bending the boundary locally. The automatic penalty, renewed as the FCM term over the number of constraints, ends at for 100 pairs and at for 10 pairs, and gives ARIs of and . Started with eight clusters on three Gaussian groups (fig. 12.10), competitive agglomeration keeps all eight for , ends with exactly three for from 5 to 20 at the default decay , and collapses to one cluster at ; a longer competition () shifts the window toward weaker weights.
Open in ColabExample plot_02_pcca_pairwise_constraints.py in the gallery
12.4.3 Co-clustering a document–term matrix
A synthetic corpus of 180 documents in four topics of 30 to 60 documents, with topic vocabularies of 15 to 30 terms and 20 general terms, has Poisson counts of mean inside the topic blocks and elsewhere; rows and columns are shuffled (fig. 12.11, left). FCCM with and recovers the topics of the documents and of the topical terms exactly (both ARIs ), and the matrix reordered by the co-clusters shows the four blocks (right). The scaled item memberships (fig. 12.12) rank every topic’s own terms by frequency and give the general terms a membership near zero in all co-clusters. The grid study (fig. 12.13) shows the units of the two weights at work. A small gives nearly crisp document memberships, fuzzy ones, and dissolves them. For there is a window, from to for , below which a co-cluster concentrates on a few frequent terms and above which the term memberships become uniform; the window closes from above as grows (– at , only at ). Fuzzy CoDoK recovers the topics exactly for and every from to , and its clipped item memberships list the topic vocabularies with exact zeros elsewhere (fig. 12.14).
Open in ColabExample plot_03_fccm_document_term.py in the gallery
12.4.4 Three collaborating sites
Three sites describe the same 300 objects in three groups with feature spreads , , and , and at the third site 15 % of the objects are moved to another group (fig. 12.15). Independently, the sites reach ARIs of , , and . With the clear site keeps its partition, the second improves to , and the third follows the majority even on its moved objects (ARI with the common groups), so that its clusters now overlap in its own feature space. The study of fig. 12.16 shows the fuzzy Rand index between every pair of sites rising monotonically with toward one, site 3 joining the majority from , and site 3 giving in most (mean membership change against and ); every site moves, because a membership pulled toward the others is also a softer one. Asymmetric collaboration matrices, whose results the example prints, give trust selectively: when only site 3 listens, sites 1 and 2 keep their independent partitions and site 3 is corrected alone (ARI ); when only the clear site 1 listens, it is pulled toward the noisier sites and drops to .
Open in ColabExample plot_04_collaborative_sites.py in the gallery
12.4.5 A library beats a single run
Four overlapping groups in six dimensions are clustered by an ensemble of 20 FCM members, each seeing two random features and 30 % of the samples (fig. 12.17). The members reach a mean ARI of and at best ; their consensus reaches , better than every member because the members err in different directions, and close to the of one FCM run on all data. The co-association matrix ordered by the consensus shows the four blocks. Over the library size (fig. 12.18), a single member is as weak as any, three to ten members bring most of the gain, and the five consensus functions behave alike, with sMCLA a few points behind from ten members on. Accuracy needs ground truth, but reproducibility does not: on ten overlapping groups in the plane, FCM with ten clusters lands in different local optima, and the fuzzy adjusted Rand index between repeated consensus partitions rises from for single runs to for libraries of 20 (fig. 12.19).
Open in ColabExample plot_05_ensemble_consensus.py in the gallery
12.4.6 Choosing the number of clusters by the lifetime
Five groups are clustered by 30 FCM members with 6 to 12 clusters each (fig. 12.20). The average-link dendrogram of gives the five-cluster partition a lifetime of , against at most for any other number, and the consensus recovers the groups exactly. The top of the dendrogram (fig. 12.21) shows where this comes from: below the band the groups fall apart into the fragments the members produced, and above it neighboring groups merge. The study of fig. 12.22 varies the members’ numbers of clusters and the linkage. Members with fewer clusters than groups (2 to 4) give three clusters, every over-segmenting range gives five with average link, and single link always returns one cluster, because chains of objects between the groups merge them at a low height. The repetition on four and six groups, printed by the example, finds four groups from every range and six groups from members with 6 to 12 or 10 to 20 clusters (five from members with 4 to 8).
Open in ColabExample plot_06_ensemble_lifetime.py in the gallery
12.5 Further reading
Partial supervision by labels goes back to Pedrycz and Waletzky [165]; pairwise constraints combined with competitive agglomeration are due to Grira, Crucianu, and Boujemaa [166], and competitive agglomeration itself to Frigui and Krishnapuram [167]. Fuzzy co-clustering with entropy regularization was introduced by Oh, Honda, and Ichihashi [168], building on Miyamoto and Mukaidono [23], and the quadratic variant by Kummamuru, Dhawale, and Krishnapuram [169]. Collaborative clustering is due to Pedrycz [170]. Cluster ensembles were framed by Strehl and Ghosh [171] (CSPA, MCLA, and the METIS graph partitioner of Karypis and Kumar [175]), extended to soft partitions by Punera and Ghosh [172] (sCSPA, sMCLA, ITK), and turned into a criterion for the number of clusters by Fred and Jain [173]; the spectral partitioning follows Ng, Jordan, and Weiss [174]. Partitions are compared with the fuzzy Rand indices of Hüllermeier et al. [45] and Campello [46] and the chance correction of Hubert and Arabie [44]; the c-means functional is that of Bezdek [3], and Jain and Dubes [4] cover hierarchical clustering in general.