
    -i                        S r SSKJrJr  SSKJrJrJr  SSKJ	r	  SSK
r
SSKrSSKJr  SSKJrJr  SS	KJrJr  S
SKJr  S
SKJrJrJrJr  \" SSSS9r\" \\S/S/S/S/S/\" \S
SSS9/\" \SSSS9/S.SS9SSSSSSSS.S j5       rg)a  Modified 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/
    )IntegralReal)PathLikemakedirsremove)existsN)loadmat   )Bunchcheck_random_state)Intervalvalidate_params   )get_data_home)RemoteFileMetadata_fetch_remote_pkl_filepath
load_descrzolivettifaces.matz.https://ndownloader.figshare.com/files/5976027@b612fb967f2dc77c9c62d3e1266e0c73d5fca46a4b8906c18e454d41af987794)filenameurlchecksumbooleanrandom_stateleft)closedg        neither)	data_homeshuffler   download_if_missing
return_X_y	n_retriesdelayT)prefer_skip_nested_validationF   g      ?c                    [        U S9n [        U 5      (       d  [        U 5        [        U S5      n[        U5      (       d  U(       d  [	        S5      e[        S[        R                  < SU < 35        [        [        XUS9n[        US9n	[        U5        U	S   R                  R                  5       n
[        R                  " XS	S
9  A	O[        R                  " U5      n
[         R"                  " U
5      n
XR%                  5       -
  n
XR'                  5       -  n
U
R)                  S5      R+                  SSS5      n
[         R,                  " [/        S5       Vs/ s H  oS-  PM	     sn5      nU(       a-  [1        U5      nUR3                  [5        U
5      5      nX   n
X   nU
R)                  [5        U
5      S5      n[7        S5      nU(       a  X4$ [9        XXS9$ s  snf )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 <olivetti_faces_dataset>`.

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 <random_state>`.

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)
)r   zolivetti.pkzz1Data not found and `download_if_missing` is Falsez downloading Olivetti faces from z to )dirnamer"   r#   )	file_namefaces   )compress)  @   r-   r   r
   r   r,   
   zolivetti_faces.rst)dataimagestargetDESCR)r   r   r   r   OSErrorprintFACESr   r   r	   r   Tcopyjoblibdumploadnpfloat32minmaxreshape	transposearrayranger   permutationlenr   r   )r   r   r   r    r!   r"   r#   filepathmat_pathmfiler)   ir2   orderfaces_vectorizedfdescrs                   S/var/www/html/venv/lib/python3.13/site-packages/sklearn/datasets/_olivetti_faces.pyfetch_olivetti_facesrN   &   s   P 	2I)Y7H("MNNEIIyQR 9
 (+xg  %%'Ea0H% JJuEIIKE	YY[EMM-(221a;EXXc
3
1Bw
34F),7((U4}}SZ4,-F''&VRR 4s   G)__doc__numbersr   r   osr   r   r   os.pathr   r9   numpyr<   scipy.ior	   utilsr   r   utils._param_validationr   r    r   _baser   r   r   r   r6   strrN        rM   <module>r\      s   
 # ) )     - ?  O O 	 8O	 8T*;'( ){ kxD@A4d9=> #' 
FSFSr[   