franky
1 min readMay 2, 2018

--

Dear Jean: First of all, thanks for your comments. This program does assume that dog images and cat images are stored under different folders. Line 3 to Line 18 put all the features for all the images from two folders into one list. Then Line 21 uses KMeans().fit() to process the list and perform clustering, i.e., put label 0 or label 1 to the members of the list. After Line 21, you can use kmeans.labels_ to get the predicted cluster for a given image. You can check the following link to get more details on KMeans and labels_ under Scikit-Learn http://scikit-learn.org/stable/modules/generated/sklearn.cluster.KMeans.html

--

--

franky
franky

No responses yet