fuzzyclust.cluster.PolynomialFuzzifierFCM#

class fuzzyclust.cluster.PolynomialFuzzifierFCM(n_clusters=3, beta=0.5, tol=0.0001, max_iter=300, init='random', n_init=1, random_state=None, verbose=0)[source]#

Bases: BaseFuzzyClusterer

Fuzzy c-means with the polynomial fuzzifier of Klawonn and Höppner.

The fuzzifier \(\mu^m\) of FCM has a derivative of zero at \(\mu=0\), which forces every sample to have a positive membership in every cluster—even a cluster on the other side of the data set. Klawonn and Höppner replace \(\mu^m\) by the quadratic polynomial

\[g(\mu)=\frac{1-\beta}{1+\beta}\,\mu^2+\frac{2\beta}{1+\beta}\,\mu,\qquad 0\le\beta<1,\]

whose slope at zero is \(2\beta/(1+\beta)>0\). A cluster whose distance exceeds that of the nearest prototype by a factor set by \(\beta\) then receives an exact zero membership, while the memberships between nearby prototypes stay fuzzy. beta=0 is FCM with \(m=2\); as \(\beta\to1\) the partition becomes crisp (k-means).

Parameters:
n_clustersint, default=3

Number of clusters \(c\).

betafloat, default=0.5

Fuzzifier parameter \(\beta\in[0,1)\). A sample at distance \(D_1\) from its nearest prototype has zero membership in every cluster farther than \(D_1/\sqrt{\beta}\); \(\beta=0.5\) is the value recommended by the authors.

tolfloat, default=1e-4
max_iterint, default=300
init{“random”, “kmeans++”} or ndarray, default=”random”
n_initint, default=1
random_stateint, RandomState instance or None, default=None
verboseint, default=0
Attributes:
cluster_centers_ndarray of shape (n_clusters, n_features)
membership_ndarray of shape (n_samples, n_clusters)

Fuzzy partition with exact zeros.

n_active_ndarray of shape (n_samples,)

Number of clusters with positive membership per training sample.

covariances_ndarray of shape (n_clusters, n_features, n_features)

Fuzzy covariance matrices of the final partition (weights \(g(\mu_{ik})\)).

labels_, distances_, objective_, objective_history_, n_iter_

See BaseFuzzyClusterer.

Notes

The functional \(J=\sum_i\sum_k g(\mu_{ik})D^2_{ik}\) is minimized under \(\sum_i\mu_{ik}=1\), \(\mu_{ik}\ge0\). With the \(\hat c_k\) nearest prototypes forming the active set \(A_k\) the memberships are

\[\mu_{ik}=\frac{1}{1-\beta}\left(\frac{1+(\hat c_k-1)\beta} {\sum_{j\in A_k}D^2_{ik}/D^2_{jk}}-\beta\right)\ (i\in A_k),\qquad \mu_{ik}=0\ (i\notin A_k),\]

where \(\hat c_k\) is the largest size for which all these values are positive; the prototypes are the \(g(\mu_{ik})\)-weighted means. The weighting exponent is fixed at m=1 internally so that the base class passes the memberships themselves to the prototype update, where \(g\) is applied.

References

[1]

F. Klawonn, F. Höppner, “What is fuzzy about fuzzy clustering? Understanding and improving the concept of the fuzzifier”, Advances in Intelligent Data Analysis V (IDA 2003), LNCS 2810, 254–264, Springer, 2003.

Examples

>>> from fuzzyclust.cluster import PolynomialFuzzifierFCM
>>> from fuzzyclust.datasets import make_fuzzy_blobs
>>> X, _ = make_fuzzy_blobs(random_state=0)
>>> pf = PolynomialFuzzifierFCM(n_clusters=3, beta=0.5, random_state=0).fit(X)
>>> bool((pf.membership_ == 0).mean() > 0.3)
True
>>> float(pf.membership_.sum(axis=1).round(6).min())
1.0

Examples using fuzzyclust.cluster.PolynomialFuzzifierFCM#

What makes a partition fuzzy: fuzzifiers, regularization, and annealing

What makes a partition fuzzy: fuzzifiers, regularization, and annealing