fuzzyclust.viz.projection_quality#
- fuzzyclust.viz.projection_quality(U, Y, Z, m=2.0, X=None)[source]#
Measures of how well a 2-D (or q-D) projection represents a fuzzy partition.
The projected prototypes \(\mathbf{z}_i\) and data \(\mathbf{y}_k\) define a recomputed partition \(\mathbf{U}^*\) (see
recomputed_membership()). The following numbers are returned (Kovács & Abonyi 2002; Feil, Balasko & Abonyi 2007; MATLABprojevalandsamstr):P– mean absolute difference of the original and recomputed memberships, \(P = \frac{1}{Nc}\sum_{i,k}|\mu_{ik}-\mu^*_{ik}|\) (eq. (1.48) of the toolbox manual; 0 means that the plot shows exactly the fitted partition);F– partition coefficient of the original partition, \(F=\frac{1}{N}\sum_{i,k}\mu_{ik}^2\);F_star– partition coefficient of the recomputed partition; a large difference \(F^*-F\) means that the plot looks crisper (or fuzzier) than the clustering really is;E– Sammon stress of the embedding with respect to the Euclidean distances ofX(only ifXis given), seesammon_stress().
- Parameters:
- Uarray_like
ofshape(n_samples,n_clusters) Fuzzy partition \(\mathbf{U}^T\) of the clustering.
- Yarray_like
ofshape(n_samples,n_components) Projected data.
- Zarray_like
ofshape(n_clusters,n_components) Projected prototypes.
- m
float, default=2.0 Fuzziness exponent used to recompute the memberships.
- Xarray_like
ofshape(n_samples,n_features),optional Original data; if given, the Sammon stress
Eis added.
- Uarray_like
- Returns:
- quality
dict Keys
"P","F","F_star"and, ifXis given,"E".
- quality
References
[1]A. Kovács, J. Abonyi, “Visualization of fuzzy clustering results by modified Sammon mapping”, Proc. 3rd Int. Symp. of Hungarian Researchers on Computational Intelligence, 177-188, 2002.
[2]B. Feil, B. Balasko, J. Abonyi, “Visualization of fuzzy clusters by fuzzy Sammon mapping projection: application to the analysis of phase space trajectories”, Soft Computing 11, 479-488, 2007.
Examples
>>> from fuzzyclust import FCM >>> from fuzzyclust.datasets import make_fuzzy_blobs >>> from fuzzyclust.viz import pca_projection, projection_quality >>> X, _ = make_fuzzy_blobs(n_clusters=3, n_features=4, random_state=0) >>> fcm = FCM(n_clusters=3, random_state=0).fit(X) >>> Y, Z, _ = pca_projection(X, 2, fcm.cluster_centers_) >>> q = projection_quality(fcm.membership_, Y, Z, m=2.0, X=X) >>> sorted(q) ['E', 'F', 'F_star', 'P']
Examples using fuzzyclust.viz.projection_quality#
Fuzzy Sammon mapping: projecting clusters, not just data