fuzzyclust.viz.plot_projection#
- fuzzyclust.viz.plot_projection(Y, Z=None, labels=None, U=None, ax=None, contours=True, m=2.0, levels=8, misclassified=None, resolution=150, legend=True, label_prefix='cluster', **kwargs)[source]#
Scatter plot of a 2-D projection with projected prototypes and membership contours.
Reproduces the plots of the MATLAB
projevalfunction: the points \(\mathbf{y}_k\), the projected centers \(\mathbf{z}_i\) (black crosses) and the level curves of the recomputed maximal membership \(\max_i\mu^*_i(\mathbf{y})\) computed from the Euclidean distances to the \(\mathbf{z}_i\) (seerecomputed_membership()). Because the contours are always circular-symmetric around the centers, their agreement with the point clouds shows how well the projection represents the clustering.- Parameters:
- Yarray_like
ofshape(n_samples, 2) Projected data.
- Zarray_like
ofshape(n_clusters, 2),optional Projected prototypes.
- labelsarray_like
ofshape(n_samples,),optional Color code (hard labels, cluster or class index).
- Uarray_like
ofshape(n_samples,n_clusters),optional Original memberships; if given together with
ZandlabelsisNone, the points are colored byU.argmax(axis=1).- contoursbool, default=True
Draw the recomputed membership contours (needs
Z).- m
float, default=2.0 Fuzziness exponent for the recomputed memberships.
- levels
intor sequence, default=8 - misclassifiedarray_like
ofboolofshape(n_samples,),optional Points to mark with an extra circle (e.g. cluster label differs from the known class, as in the toolbox case studies).
- resolution
int, default=150 Grid resolution of the contour map.
- label_prefix
str, default=”cluster” Legend text in front of the label number (e.g.
"class"when the colors are known classes rather than clusters).
- Yarray_like
Examples using fuzzyclust.viz.plot_projection#
PCA versus Sammon mapping: preserving variance or distances
Fuzzy Sammon mapping: projecting clusters, not just data
Visual validation of the number of clusters with FUZZSAM
State-space reconstruction and prediction of a chaotic time series