`L i*dZddlmZmZddlmZmZmZddlm Z ddl Z ddl Z ddl mZddlmZmZdd lmZmZd d lmZd d lmZmZmZmZed ddZeeedgdgdgdgdgeed ddgeedddgdddddddddddZy)aModified Olivetti faces dataset. The original database was available from (now defunct) https://www.cl.cam.ac.uk/research/dtg/attarchive/facedatabase.html The version retrieved here comes in MATLAB format from the personal web page of Sam Roweis: https://cs.nyu.edu/~roweis/ )IntegralReal)PathLikemakedirsremove)existsN)loadmat)Bunchcheck_random_state)Intervalvalidate_params) get_data_home)RemoteFileMetadata _fetch_remote _pkl_filepath load_descrzolivettifaces.matz.https://ndownloader.figshare.com/files/5976027@b612fb967f2dc77c9c62d3e1266e0c73d5fca46a4b8906c18e454d41af987794)filenameurlchecksumboolean random_stateleft)closedgneither) data_homeshufflerdownload_if_missing return_X_y n_retriesdelayT)prefer_skip_nested_validationFg?ct|}t|s t|t|d}t|s|s t dt dt jd|tt |||}t|} t|| djj} tj| |d ~ ntj|} t!j"| } | | j%z } | | j'z} | j)d j+d d d} t!j,t/dD cgc]} | dz c} } |r/t1|}|j3t5| } | | } | | } | j)t5| d}t7d}|r|| fSt9|| | |Scc} w)a 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 the :ref:`User Guide `. Parameters ---------- data_home : str or path-like, default=None Specify another download and cache folder for the datasets. By default all scikit-learn data is stored in '~/scikit_learn_data' subfolders. shuffle : bool, default=False If True the order of the dataset is shuffled to avoid having images of the same person grouped. random_state : int, RandomState instance or None, default=0 Determines random number generation for dataset shuffling. Pass an int for reproducible output across multiple function calls. See :term:`Glossary `. download_if_missing : bool, 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_y : bool, default=False If True, returns `(data, target)` instead of a `Bunch` object. See below for more information about the `data` and `target` object. .. versionadded:: 0.22 n_retries : int, default=3 Number of retries when HTTP errors are encountered. .. versionadded:: 1.5 delay : float, default=1.0 Number of seconds between retries. .. versionadded:: 1.5 Returns ------- data : :class:`~sklearn.utils.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. images : ndarray, shape (400, 64, 64) Each row is a face image corresponding to one of the 40 subjects of the dataset. target : ndarray, shape (400,) Labels associated to each face image. Those labels are ranging from 0-39 and correspond to the Subject IDs. DESCR : str Description of the modified Olivetti Faces Dataset. (data, target) : tuple if `return_X_y=True` Tuple with the `data` and `target` objects described above. .. versionadded:: 0.22 Examples -------- >>> 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) )rz olivetti.pkzz1Data not found and `download_if_missing` is Falsez downloading Olivetti faces from z to )dirnamer"r#) file_namefaces)compress)@r-rr rr, zolivetti_faces.rst)dataimagestargetDESCR)rrrrOSErrorprintFACESrrr rTcopyjoblibdumploadnpfloat32minmaxreshape transposearrayranger permutationlenrr )rrrr r!r"r#filepathmat_pathmfiler)ir2orderfaces_vectorizedfdescrs f/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/sklearn/datasets/_olivetti_faces.pyfetch_olivetti_facesrN&sP 2I ) Y7H ( "MN N EIIyQR 9  (+xg  %%' E8a0  H% JJu E EIIK E UYY[E MM- ( 2 21a ;E XXc 31qBw3 4F),7 ((U4e }}SZ4 , -F'' &uV6 RR4s G)__doc__numbersrrosrrros.pathrr9numpyr<scipy.ior utilsr r utils._param_validationr rr_baserrrrr6strrNrMr\s #)) -?OO  8 O 8T*;'( ){ kxD@A4d9=>#'   FS FSr[