plt scatter( [: ] [: ] =y_predcmap=mglearn cm = plt scatter(kmeans cluster_centers_[: ]kmeans cluster_centers_[: ]marker='^' =[mglearn cm ( )mglearn cm ( )] = linewidth= plt xlabel("feature "plt ylabel("feature "figure - -means fails to identify clusters with complex shapes herewe would hope that the clustering algorithm can discover the two half-moon shapes howeverthis is not possible using the -means algorithm vector quantizationor seeing -means as decomposition even though -means is clustering algorithmthere are interesting parallels between -means and the decomposition methods like pca and nmf that we discussed earlier you might remember that pca tries to find directions of maximum variance in the datawhile nmf tries to find additive componentswhich often correspond to "extremesor "partsof the data (see figure - both methods tried to express the data points as sum over some components -meanson the other handtries to represent each data point using cluster center you can think of that as each point being represented using only single componentwhich is given by the cluster center this view of -means as decomposition methodwhere each point is represented using single componentis called vector quantization unsupervised learning and preprocessing