fuzzyclust.viz.recomputed_membership#
- fuzzyclust.viz.recomputed_membership(Y, Z, m=2.0)[source]#
Fuzzy memberships recomputed in the projected space.
Every projected cluster is a point \(\mathbf{z}_i\); the membership of the projected sample \(\mathbf{y}_k\) follows the FCM formula with the Euclidean distance \(d^*_{ik}=\|\mathbf{y}_k-\mathbf{z}_i\|\):
\[\mu^*_{ik} = \frac{1}{\sum_{j=1}^{c}\left(d^*_{ik}/d^*_{jk}\right)^{2/(m-1)}} .\]The matrix \(\mathbf{U}^*=[\mu^*_{ik}]\) is what a viewer “sees” in the plot; comparing it with the original partition \(\mathbf{U}\) quantifies how faithfully the projection represents the clustering.
- Parameters:
- Yarray_like
ofshape(n_samples,n_components) Projected data.
- Zarray_like
ofshape(n_clusters,n_components) Projected cluster centers.
- m
float, default=2.0 Fuzziness exponent of the clustering.
- Yarray_like
- Returns:
- U_star
ndarrayofshape(n_samples,n_clusters)
- U_star
Examples
>>> import numpy as np >>> from fuzzyclust.viz import recomputed_membership >>> Y = np.array([[0.0, 0.0], [1.0, 0.0]]) >>> Z = np.array([[0.0, 0.0], [1.0, 0.0]]) >>> recomputed_membership(Y, Z).round(6) array([[1., 0.], [0., 1.]])