model simple solution is to use one-nearest-neighbor classifier that looks for the most similar face image to the face you are classifying this classifier could in principle work with only single training example per class let' take look at how well kneighborsclassifier does herein[ ]from sklearn neighbors import kneighborsclassifier split the data into training and test sets x_trainx_testy_trainy_test train_test_splitx_peopley_peoplestratify=y_peoplerandom_state= build kneighborsclassifier using one neighbor knn kneighborsclassifier(n_neighbors= knn fit(x_trainy_trainprint("test set score of -nn{ }format(knn score(x_testy_test))out[ ]test set score of -nn we obtain an accuracy of %which is not actually that bad for -class classification problem (random guessing would give you around / accuracy)but is also not great we only correctly identify person every fourth time this is where pca comes in computing distances in the original pixel space is quite bad way to measure similarity between faces when using pixel representation to compare two imageswe compare the grayscale value of each individual pixel to the value of the pixel in the corresponding position in the other image this representation is quite different from how humans would interpret the image of faceand it is hard to capture the facial features using this raw representation for exampleusing pixel distances means that shifting face by one pixel to the right corresponds to drastic changewith completely different representation we hope that using distances along principal components can improve our accuracy herewe enable the whitening option of pcawhich rescales the principal components to have the same scale this is the same as using standardscaler after the transformation reusing the data from figure - againwhitening corresponds to not only rotating the databut also rescaling it so that the center panel is circle instead of an ellipse (see figure - )in[ ]mglearn plots plot_pca_whitening( unsupervised learning and preprocessing