kmeans kmeans(n_clusters= kmeans fit(xy_pred kmeans predict(xplot the cluster assignments and cluster centers plt scatter( [: ] [: ] =y_predcmap=mglearn cm plt scatter(kmeans cluster_centers_[: ]kmeans cluster_centers_[: ]marker='^' =[ ] = linewidth= cmap=mglearn cm plt xlabel("feature "plt ylabel("feature "figure - -means fails to identify nonspherical clusters -means also performs poorly if the clusters have more complex shapeslike the two_moons data we encountered in (see figure - )in[ ]generate synthetic two_moons data (with less noise this timefrom sklearn datasets import make_moons xy make_moons(n_samples= noise= random_state= cluster the data into two clusters kmeans kmeans(n_clusters= kmeans fit(xy_pred kmeans predict(xclustering