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 projeval function: 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\) (see recomputed_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 of shape (n_samples, 2)

Projected data.

Zarray_like of shape (n_clusters, 2), optional

Projected prototypes.

labelsarray_like of shape (n_samples,), optional

Color code (hard labels, cluster or class index).

Uarray_like of shape (n_samples, n_clusters), optional

Original memberships; if given together with Z and labels is None, the points are colored by U.argmax(axis=1).

contoursbool, default=True

Draw the recomputed membership contours (needs Z).

mfloat, default=2.0

Fuzziness exponent for the recomputed memberships.

levelsint or sequence, default=8
misclassifiedarray_like of bool of shape (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).

resolutionint, default=150

Grid resolution of the contour map.

label_prefixstr, default=”cluster”

Legend text in front of the label number (e.g. "class" when the colors are known classes rather than clusters).

Examples using fuzzyclust.viz.plot_projection#

PCA versus Sammon mapping: preserving variance or distances

PCA versus Sammon mapping: preserving variance or distances

Fuzzy Sammon mapping: projecting clusters, not just data

Fuzzy Sammon mapping: projecting clusters, not just data

Visual validation of the number of clusters with FUZZSAM

Visual validation of the number of clusters with FUZZSAM

State-space reconstruction and prediction of a chaotic time series

State-space reconstruction and prediction of a chaotic time series