tiple peoplebut they share similar orientation and expression this concludes our analysis of the dbscan algorithm applied to the faces dataset as you can seewe are doing manual analysis heredifferent from the much more automatic search approach we could use for supervised learning based on score or accuracy let' move on to applying -means and agglomerative clustering analyzing the faces dataset with -means we saw that it was not possible to create more than one big cluster using dbscan agglomerative clustering and -means are much more likely to create clusters of even sizebut we do need to set target number of clusters we could set the number of clusters to the known number of people in the datasetthough it is very unlikely that an unsupervised clustering algorithm will recover them insteadwe can start with low number of clusterslike which might allow us to analyze each of the clustersin[ ]extract clusters with -means km kmeans(n_clusters= random_state= labels_km km fit_predict(x_pcaprint("cluster sizes -means{}format(np bincount(labels_km))out[ ]cluster sizes -means[ as you can seek-means clustering partitioned the data into relatively similarly sized clusters from to this is quite different from the result of dbscan we can further analyze the outcome of -means by visualizing the cluster centers (figure - as we clustered in the representation produced by pcawe need to rotate the cluster centers back into the original space to visualize themusing pca inverse_transformin[ ]figaxes plt subplots( subplot_kw={'xticks'()'yticks'()}figsize=( )for centerax in zip(km cluster_centers_axes ravel())ax imshow(pca inverse_transform(centerreshape(image_shape)vmin= vmax= unsupervised learning and preprocessing