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]#
从 AT&T 加载 Olivetti faces 数据集(分类)。
Download it if necessary.
类别数
40
样本总数
400
维度
4096
特征值范围
实数,介于 0 和 1 之间
Read more in the User Guide.
- 参数:
- data_homestr or path-like, default=None
为数据集指定另一个下载和缓存文件夹。默认情况下,所有 scikit-learn 数据都存储在 ‘~/scikit_learn_data’ 子文件夹中。
- shufflebool, default=False
If True the order of the dataset is shuffled to avoid having images of the same person grouped.
- random_stateint, RandomState instance or None, default=0
Determines random number generation for dataset shuffling. Pass an int for reproducible output across multiple function calls. See Glossary.
- download_if_missingbool, default=True
If False, raise an OSError if the data is not locally available instead of trying to download the data from the source site.
- return_X_ybool, default=False
If True, returns
(data, target)instead of aBunchobject. See below for more information about thedataandtargetobject.版本 0.22 新增。
- n_retriesint, default=3
Number of retries when HTTP errors are encountered.
1.5 版本新增。
- delayfloat, default=1.0
Number of seconds between retries.
1.5 版本新增。
- 返回:
- data
Bunch Dictionary-like object, with the following attributes.
- data: ndarray, shape (400, 4096)
Each row corresponds to a ravelled face image of original size 64 x 64 pixels.
- imagesndarray, shape (400, 64, 64)
Each row is a face image corresponding 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 the Subject IDs.
- DESCRstr
Description of the modified Olivetti Faces Dataset.
- (data, target)tuple if
return_X_y=True Tuple with the
dataandtargetobjects described above.版本 0.22 新增。
- data
示例
>>> from sklearn.datasets import fetch_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)