print("cluster memberships:\ {}format(kmeans labels_)out[ ]cluster memberships[ as we asked for three clustersthe clusters are numbered to you can also assign cluster labels to new pointsusing the predict method each new point is assigned to the closest cluster center when predictingbut the existing model is not changed running predict on the training set returns the same result as labels_in[ ]print(kmeans predict( )out[ ][ you can see that clustering is somewhat similar to classificationin that each item gets label howeverthere is no ground truthand consequently the labels themselves have no priori meaning let' go back to the example of clustering face images that we discussed before it might be that the cluster found by the algorithm contains only faces of your friend bela you can only know that after you look at the picturesthoughand the number is arbitrary the only information the algorithm gives you is that all faces labeled as are similar for the clustering we just computed on the two-dimensional toy datasetthat means that we should not assign any significance to the fact that one group was labeled and another one was labeled running the algorithm again might result in different numbering of clusters because of the random nature of the initialization here is plot of this data again (figure - the cluster centers are stored in the cluster_centers_ attributeand we plot them as trianglesin[ ]mglearn discrete_scatter( [: ] [: ]kmeans labels_markers=' 'mglearn discrete_scatterkmeans cluster_centers_[: ]kmeans cluster_centers_[: ][ ]markers='^'markeredgewidth= clustering