fuzzyclust.coclustering.FCoDoK#

class fuzzyclust.coclustering.FCoDoK(n_clusters=3, lambda_u=1.0, lambda_w=1.0, tol=0.0001, max_iter=300, init='random', n_init=1, random_state=None, verbose=0)[source]#

Bases: _BaseFuzzyCoClustering

Fuzzy co-clustering of documents and keywords, Fuzzy CoDoK (Kummamuru, Dhawale, Krishnapuram, 2003).

The same aggregation objective as FCCM, regularized by the squared memberships instead of their entropies. The quadratic regularizer makes the updates linear – a membership is the uniform value plus a term proportional to how much the entity’s aggregation with the cluster exceeds the average – so that the method scales to large document collections and is less prone to the numerical overflow of the exponentials; memberships that would become negative are clipped and the row (or the cluster’s item vector) renormalized.

Parameters:
n_clustersint, default=3
lambda_ufloat, default=1.0

Weight \(T_u>0\) of the quadratic regularizer of the object memberships; larger values give fuzzier objects (same units as in FCCM).

lambda_wfloat, default=1.0

Weight \(T_w>0\) for the item memberships.

tol, max_iter, init, n_init, random_state, verbose

See FCCM.

Attributes:
membership_, item_membership_, labels_, item_labels_, aggregation_

See FCCM.

objective_, objective_history_, n_iter_

See FCCM.

Notes

Fuzzy CoDoK maximizes

\[J = \sum_{i=1}^{c}\sum_{k=1}^{N}\sum_{j=1}^{M} u_{ik}w_{ij}r_{kj} - T_u\sum_{i=1}^{c}\sum_{k=1}^{N} u_{ik}^2 - T_w\sum_{i=1}^{c}\sum_{j=1}^{M} w_{ij}^2\]

subject to \(\sum_i u_{ik}=1\), \(\sum_j w_{ij}=1\). With the aggregations \(a_{ik}=\sum_j w_{ij}r_{kj}\) and \(b_{ij}=\sum_k u_{ik}r_{kj}\) the necessary conditions read

\[u_{ik} = \frac{1}{c} + \frac{1}{2T_u}\Big(a_{ik}-\frac1c\sum_{l=1}^{c}a_{lk}\Big),\qquad w_{ij} = \frac{1}{M} + \frac{1}{2T_w}\Big(b_{ij}-\frac1M\sum_{l=1}^{M}b_{il}\Big),\]

followed by clipping at zero and renormalization.

References

[1]

K. Kummamuru, A. Dhawale, R. Krishnapuram, “Fuzzy co-clustering of documents and keywords”, Proc. 12th IEEE International Conference on Fuzzy Systems (FUZZ-IEEE), vol. 2, 772–777, 2003.

Examples

>>> from fuzzyclust.coclustering import FCoDoK, make_block_matrix
>>> R, rows, cols = make_block_matrix(random_state=0)
>>> codok = FCoDoK(n_clusters=3, lambda_u=2.0, lambda_w=50.0, random_state=0).fit(R)
>>> codok.membership_.shape
(120, 3)

Examples using fuzzyclust.coclustering.FCoDoK#

Fuzzy co-clustering of a document–term matrix

Fuzzy co-clustering of a document--term matrix