fetch_olivetti_faces#

sklearn.datasets.fetch_olivetti_faces(*,data_home=None,shuffle=False,random_state=0,download_if_missing=True,return_X_y=False,n_retries=3,delay=1.0)[source]#

Load the Olivetti faces data-set from AT&T (classification).

Download it if necessary.

Classes

40

Samples total

400

Dimensionality

4096

Features

real, between 0 and 1

Read more in theUser Guide.

Parameters:
data_homestr or path-like, default=None

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

shufflebool, default=False

If True the order of the dataset is shuffled to avoid havingimages of the same person grouped.

random_stateint, RandomState instance or None, default=0

Determines random number generation for dataset shuffling. Pass an intfor reproducible output across multiple function calls.SeeGlossary.

download_if_missingbool, default=True

If False, raise an OSError if the data is not locally availableinstead of trying to download the data from the source site.

return_X_ybool, default=False

If True, returns(data,target) instead of aBunch object. Seebelow for more information about thedata andtarget object.

Added in version 0.22.

n_retriesint, default=3

Number of retries when HTTP errors are encountered.

Added in version 1.5.

delayfloat, default=1.0

Number of seconds between retries.

Added in version 1.5.

Returns:
dataBunch

Dictionary-like object, with the following attributes.

data: ndarray, shape (400, 4096)

Each row corresponds to a ravelledface image of original size 64 x 64 pixels.

imagesndarray, shape (400, 64, 64)

Each row is a face imagecorresponding to one of the 40 subjects of the dataset.

targetndarray, shape (400,)

Labels associated to each face image.Those labels are ranging from 0-39 and correspond to theSubject IDs.

DESCRstr

Description of the modified Olivetti Faces Dataset.

(data, target)tuple ifreturn_X_y=True

Tuple with thedata andtarget objects described above.

Added in version 0.22.

Examples

>>>fromsklearn.datasetsimportfetch_olivetti_faces>>>olivetti_faces=fetch_olivetti_faces()>>>olivetti_faces.data.shape(400, 4096)>>>olivetti_faces.target.shape(400,)>>>olivetti_faces.images.shape(400, 64, 64)

Gallery examples#

Online learning of a dictionary of parts of faces

Online learning of a dictionary of parts of faces

Faces dataset decompositions

Faces dataset decompositions

Face completion with a multi-output estimators

Face completion with a multi-output estimators