fuzzyclust.extensions.VolumePrototypeFCM#
- class fuzzyclust.extensions.VolumePrototypeFCM(n_clusters=3, m=2.0, norm='euclidean', radius='fuzzy_mean', radius_scale=1.0, merge=False, similarity_threshold=0.2, gamma=0.0, beta=1000000000000000.0, tol=0.0001, max_iter=300, init='random', n_init=1, random_state=None, verbose=0)[source]#
Bases:
BaseFuzzyClustererFuzzy c-means with volume prototypes and optional adaptive cluster merging (Kaymak & Setnes, 2002).
A point prototype measures the distance to the center of a cluster, so a sample in the middle of a large cluster is farther from its own prototype than a sample at the edge of a small one: this is why FCM and GK tend to equalize cluster sizes and split large clusters. A volume prototype replaces the point by a hyperellipsoidal core of radius \(r_i\) (in the norm of the cluster) inside which the distance is zero; only the distance to the surface of the core counts,
\[\tilde D_{ik}=\max\bigl(0,\;D_{ik}-r_i\bigr),\]so every sample inside the core belongs fully to the cluster and a large cluster can absorb its members without having to compete for them point by point. The core radius adapts to the cluster. Kaymak and Setnes combine the volume prototypes with adaptive cluster merging: the algorithm is started with more clusters than expected and, whenever two clusters have become similar as fuzzy sets, they are merged and the iteration continues with one cluster less, so that the number of clusters is found during the clustering itself.
- Parameters:
- n_clusters
int, default=3 Number of clusters \(c\) (the initial, maximal number when
merge=True; the final number isn_clusters_).- m
float, default=2.0 Fuzziness exponent \(m>1\).
- norm{“euclidean”, “adaptive”}, default=”euclidean”
Distance to the center: Euclidean (spherical cores) or the Gustafson–Kessel norm \(\mathbf{A}_i=[\det\mathbf{F}_i]^{1/n}\mathbf{F}_i^{-1}\) (ellipsoidal cores aligned with the clusters).
- radius{“fuzzy_mean”}
orfloator array_likeofshape(n_clusters,), default=”fuzzy_mean” Core radius.
"fuzzy_mean"re-estimates \(r_i=\rho\sum_k\mu_{ik}^mD_{ik}/\sum_k\mu_{ik}^m\) (the membership-weighted mean distance of the data to the center, in the cluster norm) at every iteration; a number or an array fixes the radii.0recovers FCM/GK.- radius_scale
float, default=1.0 Factor \(\rho\) of the estimated radius; larger cores make the memberships crisper and the clusters greedier.
- mergebool, default=False
Adaptive cluster merging: whenever the partition has converged for the current number of clusters, the most similar pair of clusters with \(S_{ij}\) above
similarity_thresholdis merged (their membership columns are added) and the iteration continues with one cluster less until no similar pair remains.- similarity_threshold
float, default=0.2 Threshold on the fuzzy-set similarity \(S_{ij}\) of two clusters. The similarity is evaluated on the memberships that the center distances alone would give (the cores make the memberships nearly crisp and would hide the overlap), rescaled to the reference exponent \(m=2\) as in
CompatibleClusterMerging.- gamma
float, default=0.0 - beta
float, default=1e15 Covariance regularization of the adaptive norm, as in
GK.- tol
float, default=1e-4 - max_iter
int, default=300 Maximum number of iterations; with
merge=Trueper number of clusters (the iterations after every merge are counted afresh), so that a long merge sequence is not cut short.- init{“random”, “kmeans++”}
orndarray, default=”random” - n_init
int, default=1 - random_state
int,RandomStateinstanceorNone, default=None - verbose
int, default=0
- n_clusters
- Attributes:
- cluster_centers_
ndarrayofshape(n_clusters_,n_features) - radii_
ndarrayofshape(n_clusters_,) Core radii \(r_i\) at convergence.
- n_clusters_
int Final number of clusters (
n_clustersunless merging reduced it).- membership_
ndarrayofshape(n_samples,n_clusters_) - covariances_
ndarrayofshape(n_clusters_,n_features,n_features) Fuzzy covariance matrices of the final partition.
- norm_matrices_
ndarrayofshape(n_clusters_,n_features,n_features) Norm-inducing matrices (identity for the Euclidean norm).
- merge_history_
listofdict One entry per merge:
iteration,n_clusters(before),pair,similarity.- labels_, distances_, objective_, objective_history_, n_iter_
See
BaseFuzzyClusterer;distances_andtransformreturn \(\tilde D_{ik}\), zero inside the cores.
- cluster_centers_
Notes
The functional is the c-means functional with the core distance, \(J=\sum_i\sum_k\mu_{ik}^m\tilde D^2_{ik}\), with \(\tilde D_{ik}=\max(0,D_{ik\mathbf{A}_i}-r_i)\), \(D^2_{ik\mathbf{A}_i}=(\mathbf{x}_k-\mathbf{v}_i)^T\mathbf{A}_i(\mathbf{x}_k-\mathbf{v}_i)\). Memberships follow the FCM formula (a sample inside exactly one core has membership one there), centers are the \(\mu^m\)-weighted means, the norms are those of GK when
norm="adaptive", and the radii are re-estimated from the current partition. The similarity of two clusters is \(S_{ij}=\sum_k\min(\mu_{ik},\mu_{jk})/\sum_k\max(\mu_{ik},\mu_{jk})\) (Setnes et al.). This differs from Kaymak and Setnes, who use the inclusion measure \(\max(I_{ij},I_{ji})\), \(I_{ij}=\sum_k\min(\mu_{ik},\mu_{jk})/\sum_k\mu_{ik}\), merge during the iterations with the threshold \(1/(c-1)\) and derive the radius from the fuzzy covariance; here clusters are merged after convergence with a fixed threshold, and the default radius is a fuzzy mean distance.References
[1]U. Kaymak, M. Setnes, “Fuzzy clustering with volume prototypes and adaptive cluster merging”, IEEE Transactions on Fuzzy Systems 10(6), 705–712, 2002.
[2]M. Setnes, R. Babuška, U. Kaymak, H. R. van Nauta Lemke, “Similarity measures in fuzzy rule base simplification”, IEEE Transactions on Systems, Man, and Cybernetics B 28(3), 376–386, 1998.
Examples
>>> from fuzzyclust.extensions import VolumePrototypeFCM >>> from fuzzyclust.datasets import make_different_densities >>> X, _ = make_different_densities(random_state=0) >>> vp = VolumePrototypeFCM(n_clusters=3, random_state=0).fit(X) >>> vp.radii_.shape (3,) >>> vpm = VolumePrototypeFCM(n_clusters=8, merge=True, random_state=0).fit(X) >>> int(vpm.n_clusters_) < 8 True