Faces recognition example using eigenfaces and kernel approximation
This example builds a classical face recognition pipeline on the “Labeled Faces in the Wild” (LFW) dataset, a preprocessed excerpt of which is available here: https://www.kaggle.com/datasets/jessicali9530/lfw-dataset
We reduce the dimensionality of the face images with PCA (the eigenfaces), then
approximate the RBF kernel with Nystroem
and train a LogisticRegression on the resulting
features. The full chain is wrapped in a Pipeline so
that cross-validation does not leak information from the test set. The
hyperparameters are tuned with a successive halving search
() that minimizes the
log loss. We finally evaluate the model both quantitatively, with a
classification report and one-vs-rest ROC and precision-recall curves, and
qualitatively, by displaying the predictions and the eigenfaces.


