§
    ¥˜ºhÊ  ã                   óö   — d Z ddlmZmZmZ ddlmZ ddlZddlZ	ddl
mZ ddlmZmZ ddlmZ d	d
lmZ d	dlmZmZmZmZ  eddd¬¦  «        Z eeedgdgdgdgdgdœd¬¦  «        ddddddœd„¦   «         ZdS )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/
é    )ÚPathLikeÚmakedirsÚremove)ÚexistsN)Úloadmaté   )ÚBunchÚcheck_random_state)Ú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)Ú	data_homeÚshuffler   Údownload_if_missingÚ
return_X_yT)Úprefer_skip_nested_validationFc                 óH  — t          | ¬¦  «        } t          | ¦  «        st          | ¦  «         t          | d¦  «        }t          |¦  «        s�|st	          d¦  «        ‚t          dt          j        ›d| ›�¦  «         t          t          | ¬¦  «        }t          |¬¦  «        }t          |¦  «         |d         j                             ¦   «         }t          j        ||d	¬
¦  «         ~nt          j        |¦  «        }t!          j        |¦  «        }||                     ¦   «         z
  }||                     ¦   «         z  }|                     d¦  «                             ddd¦  «        }t!          j        d„ t/          d¦  «        D ¦   «         ¦  «        }	|rAt1          |¦  «        }|                     t5          |¦  «        ¦  «        }
||
         }|	|
         }	|                     t5          |¦  «        d¦  «        }t7          d¦  «        }|r||	fS t9          |||	|¬¦  «        S )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

    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
    )r   zolivetti.pkzz1Data not found and `download_if_missing` is Falsez downloading Olivetti faces from z to )Údirname)Ú	file_nameÚfacesé   )Úcompress)é�  é@   r$   r   r   r   c                 ó   — g | ]}|d z  ‘ŒS )é
   © )Ú.0Úis     úh/var/www/html/services/rag-service/venv/lib/python3.11/site-packages/sklearn/datasets/_olivetti_faces.pyú
<listcomp>z(fetch_olivetti_faces.<locals>.<listcomp>�   s   € Ð3Ð3Ð3 1�q˜B‘wÐ3Ð3Ð3ó    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   ÚfilepathÚmat_pathÚmfiler    r0   ÚorderÚfaces_vectorizedÚfdescrs                r*   Úfetch_olivetti_facesrJ   %   s	  € õ^ ¨	Ð2Ñ2Ô2€IÝ�)ÑÔð Ý�ÑÔÐÝ˜Y¨Ñ7Ô7€HÝ�(ÑÔð &Ø"ð 	OÝÐMÑNÔNÐNåˆ½E¼I¸I¸IÀyÀyÐQÑRÔRÐRÝ ¥°	Ð:Ñ:Ô:ˆÝ (Ð+Ñ+Ô+ˆåˆxÑÔÐà�g”Ô ×%Ò%Ñ'Ô'ˆÝŒ�E˜8¨aÐ0Ñ0Ô0Ð0ØˆEå”˜HÑ%Ô%ˆõ ŒJ�uÑÔ€EØ�E—I’I‘K”KÑ€EØ	ˆU�YŠY‰[Œ[Ñ€EØ�MŠM˜-Ñ(Ô(×2Ò2°1°a¸Ñ;Ô;€EåŒXÐ3Ð3­¨c©
¬
Ð3Ñ3Ô3Ñ4Ô4€FØð Ý)¨,Ñ7Ô7ˆØ×(Ò(­¨U©¬Ñ4Ô4ˆØ�e”ˆØ˜”ˆØ—}’}¥S¨¡Z¤Z°Ñ4Ô4ÐåÐ,Ñ-Ô-€Fàð (Ø Ð'Ð'åÐ&¨u¸VÈ6ÐRÑRÔRÐRr,   )Ú__doc__Úosr   r   r   Úos.pathr   r7   Únumpyr:   Úscipy.ior   Úutilsr	   r
   Úutils._param_validationr   Ú r   Ú_baser   r   r   r   r4   ÚstrrJ   r'   r,   r*   ú<module>rU      sz  ðð
ð 
ð *Ð )Ð )Ð )Ð )Ð )Ð )Ð )Ð )Ð )Ø Ð Ð Ð Ð Ð à €€€Ø Ð Ð Ð Ø Ð Ð Ð Ð Ð à -Ð -Ð -Ð -Ð -Ð -Ð -Ð -Ø 5Ð 5Ð 5Ð 5Ð 5Ð 5Ø Ð Ð Ð Ð Ð Ø OÐ OÐ OÐ OÐ OÐ OÐ OÐ OÐ OÐ OÐ OÐ Oð 	ÐØ Ø8ØOð	ñ 	ô 	€ð €à˜8 TÐ*Ø�;Ø'Ð(Ø )˜{Ø �kðð ð #'ð	ñ 	ô 	ð ØØØØðmSð mSð mSð mSñ	ô 	ðmSð mSð mSr,   