This documentation is for scikit-learn version 0.10Other versions

Citing

If you use the software, please consider citing scikit-learn.

This page

8.4.1.8. sklearn.datasets.fetch_lfw_pairs

sklearn.datasets.fetch_lfw_pairs(subset='train', data_home=None, funneled=True, resize=0.5, color=False, slice_=(slice(70, 195, None), slice(78, 172, None)), download_if_missing=True)

Loader for the Labeled Faces in the Wild (LFW) pairs dataset

This dataset is a collection of JPEG pictures of famous people collected on the internet, all details are available on the official website:

Each picture is centered on a single face. Each pixel of each channel (color in RGB) is encoded by a float in range 0.0 - 1.0.

The task is called Face Verification: given a pair of two pictures, a binary classifier must predict whether the two images are from the same person.

In the official README.txt this task is described as the “Restricted” task. As I am not sure as to implement the “Unrestricted” variant correctly, I left it as unsupported for now.

Parameters :

subset: optional, default: ‘train’ :

Select the dataset to load: ‘train’ for the development training set, ‘test’ for the development test set, and ‘10_folds’ for the official evaluation set that is meant to be used with a 10-folds cross validation.

data_home: optional, default: None :

Specify another download and cache folder for the datasets. By default all scikit learn data is stored in ‘~/scikit_learn_data’ subfolders.

funneled: boolean, optional, default: True :

Download and use the funneled variant of the dataset.

resize: float, optional, default 0.5 :

Ratio used to resize the each face picture.

color: boolean, optional, default False :

Keep the 3 RGB channels instead of averaging them to a single gray level channel. If color is True the shape of the data has one more dimension than than the shape with color = False.

slice_: optional :

Provide a custom 2D slice (height, width) to extract the ‘interesting’ part of the jpeg files and avoid use statistical correlation from the background

download_if_missing: optional, True by default :

If False, raise a IOError if the data is not locally available instead of trying to download the data from the source site.