
    -i<X                        S r SSKrSSKJrJr  SSKJrJrJrJ	r	  SSK
JrJrJr  SSKrSSKJr  SSKJr  SS	KJrJrJrJr  SS
KJr  SSKJrJrJrJr  \R@                  " \!5      r"\" SSSS9r#\" SSSS9r$\" SSSS9\" SSSS9\" SSSS94r% S6S  jr&S! r' S7S# jr(\" \)\S/S$/\" \SSS%S&9S/\" \SSS'S&9S/S$/\*\" S5      /S$/S$/\" \SSS'S&9/\" \S(SS%S&9/S).
SS*9SSS+SS"\+" S,S-5      \+" S.S/5      4SS"SSS).
S0 j5       r, S8S1 jr-\" \" 1 S2k5      /\)\S/S$/\" \SSS%S&9S/S$/\*\" S5      /S$/\" \SSS'S&9/\" \S(SS%S&9/S3.	SS*9S4SSS+S"\+" S,S-5      \+" S.S/5      4SSSS3.	S5 j5       r.g)9zLabeled Faces in the Wild (LFW) dataset

This dataset is a collection of JPEG pictures of famous people collected
over the internet, all details are available on the official website:

    http://vis-www.cs.umass.edu/lfw/
    N)IntegralReal)PathLikelistdirmakedirsremove)existsisdirjoin)Memory   )Bunch)HiddenInterval
StrOptionsvalidate_params)tarfile_extractall   )RemoteFileMetadata_fetch_remoteget_data_home
load_descrzlfw.tgzz.https://ndownloader.figshare.com/files/5976018@055f7d9c632d7370e6fb4afc7468d40f970c34a80d4c6f50ffec63f5a8d536c0)filenameurlchecksumzlfw-funneled.tgzz.https://ndownloader.figshare.com/files/5976015@b47c8422c8cded889dc5a13418c4bc2abbda121092b3533a83306f90d900100apairsDevTrain.txtz.https://ndownloader.figshare.com/files/5976012@1d454dada7dfeca0e7eab6f65dc4e97a6312d44cf142207be28d688be92aabfapairsDevTest.txtz.https://ndownloader.figshare.com/files/5976009@7cb06600ea8b2814ac26e946201cdb304296262aad67d046a16a7ec85d0ff87c	pairs.txtz.https://ndownloader.figshare.com/files/5976006@ea42330c62c92989f9d7c03237ed5d591365e89b3e649747777b70e692dc1592T         ?c                 D   [        U S9n [        U S5      n[        U5      (       d  [        U5        [         Hi  n[        XVR
                  5      n[        U5      (       a  M*  U(       a,  [        R                  SUR                  5        [        XeX4S9  M]  [        SU-  5      e   U(       a  [        US5      n[        n	O[        US5      n[        n	[        U5      (       d  [        XYR
                  5      n
[        U
5      (       d@  U(       a+  [        R                  SU	R                  5        [        XX4S9  O[        SU
-  5      eS	S
Kn[        R                  SU5        UR                  U
S5       n[!        XS9  S
S
S
5        [#        U
5        XX4$ ! , (       d  f       N= f)z0Helper function to download any missing LFW data)	data_homelfw_homezDownloading LFW metadata: %s)dirname	n_retriesdelayz%s is missinglfw_funneledlfwz!Downloading LFW data (~200MB): %sr   Nz$Decompressing the data archive to %szr:gz)path)r   r   r	   r   TARGETSr   loggerinfor   r   OSErrorFUNNELED_ARCHIVEARCHIVEtarfiledebugopenr   r   )r'   funneleddownload_if_missingr*   r+   r(   targettarget_filepathdata_folder_patharchivearchive_pathr5   fps                H/var/www/html/venv/lib/python3.13/site-packages/sklearn/datasets/_lfw.py_check_fetch_lfwrA   M   sV   
 	2IIz*H(x9o&&":FJJG	 o?@@  .9"%0"##H&6&67l##"?M o<==;=MN\\,/2r1 0 	|%% 0/s   1
F
Fc                     SSK Jn  [        SS5      [        SS5      4nUc  UnO[	        S [        X5       5       5      nUu  pgUR                  UR                  -
  UR                  =(       d    S-  nUR                  UR                  -
  UR                  =(       d    S-  n	Ub%  [        U5      n[        X8-  5      n[        X9-  5      n	[        U 5      n
U(       d&  [        R                  " XU	4[        R                  S9nO&[        R                  " XU	S4[        R                  S9n[        U 5       H  u  pUS	-  S:X  a  [         R#                  S
US-   U
5        UR%                  U5      nUR'                  UR                  UR                  UR                  UR                  45      nUb  UR)                  X45      n[        R*                  " U[        R                  S9nUR,                  S:X  a  [/        SU-  5      eUS-  nU(       d  UR1                  SS9nXUS4'   M     U$ ! [         a    [        S5      ef = f)zInternally used to load imagesr   )ImagezThe Python Imaging Library (PIL) is required to load data from jpeg files. Please refer to https://pillow.readthedocs.io/en/stable/installation.html for installing PIL.   c              3   <   #    U  H  u  pU=(       d    Uv   M     g 7f)N ).0sdss      r@   	<genexpr>_load_imgs.<locals>.<genexpr>   s     G,F51qwBw,Fs   r   dtyper$   i  zLoading face #%05d / %05dzLFailed to read the image file %s, Please make sure that libjpeg is installedg     o@r   )axis.)PILrC   ImportErrorslicetuplezipstopstartstepfloatintlennpzerosfloat32	enumerater0   r6   r7   cropresizeasarrayndimRuntimeErrormean)
file_pathsslice_colorr_   rC   default_sliceh_slicew_slicehwn_facesfacesi	file_pathpil_imgfaces                   r@   
_load_imgsrr      s   
 1c]E!SM2M~GC,FGGG		%7<<+<1=A		%7<<+<1=Av
O
O *oG'a

;'a+2::> "*-t8q=LL4a!eWE **Y',,]]GMM7<<F
 nnaV,Gzz'499>=?HI 
 	 99!9$Daf5 .8 L}  
"
 	

s   H' 'H=Fc                    / / pe[        [        U 5      5       H  n[        X5      n[        U5      (       d  M   [        [        U5      5       V	s/ s H  n	[        X5      PM     n
n	[	        U
5      nX:  d  M_  UR                  SS5      nUR                  U/U-  5        UR                  U
5        M     [	        U5      nUS:X  a  [        SU-  5      e[        R                  " U5      n[        R                  " X5      n[        XaX#5      n[        R                  " U5      n[        R                  R                  S5      R                  U5        UU   UU   pXU4$ s  sn	f )zvPerform the actual data loading for the lfw people dataset

This operation is meant to be cached by a joblib wrapper.
_ r   z*min_faces_per_person=%d is too restrictive*   )sortedr   r   r
   rY   replaceextend
ValueErrorrZ   uniquesearchsortedrr   arangerandomRandomStateshuffle)r<   re   rf   r_   min_faces_per_personperson_namesrd   person_namefolder_pathfpaths
n_picturesrl   target_namesr:   rm   indicess                    r@   _fetch_lfw_peopler      sA     "2*g&678+9[!!/5gk6J/KL/K!k%/KLZ
-%--c37K
 :;e$ 9 *oG!|8;OO
 	
 99\*L__\8Fz59E ii GII"%%g.'NF7O6,&&5 Ms   Ebooleanneither)closedleftg        )
r'   r8   r_   r   rf   re   r9   
return_X_yr*   r+   )prefer_skip_nested_validationg      ?F      N      c        
             [        U UUUU	S9u  p[        R                  SU
5        [        U
SSS9nUR	                  [
        5      nU" UUUUUS9u  pnUR                  [        U5      S5      n[        S5      nU(       a  UU4$ [        UXUUS	9$ )
a  Load the Labeled Faces in the Wild (LFW) people dataset (classification).

Download it if necessary.

=================   =======================
Classes                                5749
Samples total                         13233
Dimensionality                         5828
Features            real, between 0 and 255
=================   =======================

For a usage example of this dataset, see
:ref:`sphx_glr_auto_examples_applications_plot_face_recognition.py`.

Read more in the :ref:`User Guide <labeled_faces_in_the_wild_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.

funneled : bool, default=True
    Download and use the funneled variant of the dataset.

resize : float or None, default=0.5
    Ratio used to resize the each face picture. If `None`, no resizing is
    performed.

min_faces_per_person : int, default=None
    The extracted dataset will only retain pictures of people that have at
    least `min_faces_per_person` different pictures.

color : bool, default=False
    Keep the 3 RGB channels instead of averaging them to a single
    gray level channel. If color is True the shape of the data has
    one more dimension than the shape with color = False.

slice_ : tuple of slice, default=(slice(70, 195), slice(78, 172))
    Provide a custom 2D slice (height, width) to extract the
    'interesting' part of the jpeg files and avoid use statistical
    correlation from the background.

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 ``(dataset.data, dataset.target)`` instead of a Bunch
    object. See below for more information about the `dataset.data` and
    `dataset.target` object.

    .. versionadded:: 0.20

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
-------
dataset : :class:`~sklearn.utils.Bunch`
    Dictionary-like object, with the following attributes.

    data : numpy array of shape (13233, 2914)
        Each row corresponds to a ravelled face image
        of original size 62 x 47 pixels.
        Changing the ``slice_`` or resize parameters will change the
        shape of the output.
    images : numpy array of shape (13233, 62, 47)
        Each row is a face image corresponding to one of the 5749 people in
        the dataset. Changing the ``slice_``
        or resize parameters will change the shape of the output.
    target : numpy array of shape (13233,)
        Labels associated to each face image.
        Those labels range from 0-5748 and correspond to the person IDs.
    target_names : numpy array of shape (5749,)
        Names of all persons in the dataset.
        Position in array corresponds to the person ID in the target array.
    DESCR : str
        Description of the Labeled Faces in the Wild (LFW) dataset.

(data, target) : tuple if ``return_X_y`` is True
    A tuple of two ndarray. The first containing a 2D array of
    shape (n_samples, n_features) with each row representing one
    sample and each column representing the features. The second
    ndarray of shape (n_samples,) containing the target samples.

    .. versionadded:: 0.20

Examples
--------
>>> from sklearn.datasets import fetch_lfw_people
>>> lfw_people = fetch_lfw_people()
>>> lfw_people.data.shape
(13233, 2914)
>>> lfw_people.target.shape
(13233,)
>>> for name in lfw_people.target_names[:5]:
...    print(name)
AJ Cook
AJ Lamas
Aaron Eckhart
Aaron Guiel
Aaron Patterson
r'   r8   r9   r*   r+   z Loading LFW people faces from %s   r   locationcompressverbose)r_   r   rf   re   lfw.rst)dataimagesr:   r   DESCR)
rA   r0   r6   r   cacher   reshaperY   r   r   )r'   r8   r_   r   rf   re   r9   r   r*   r+   r(   r<   m	load_funcrm   r:   r   Xfdescrs                      r@   fetch_lfw_peopler      s    X "2/"H LL3X> 	1a8A)*I #,1#E< 	c%j"%A	"F&y u,f     c           
         [        U S5       nU Vs/ s H/  ofR                  5       R                  5       R                  S5      PM1     nnSSS5        W Vs/ s H  n[	        U5      S:  d  M  UPM     n	n[	        U	5      n
[
        R                  " U
[        S9n[        5       n[        U	5       H  u  p[	        U5      S:X  a1  SX'   US   [        US   5      S-
  4US   [        US   5      S-
  44nOS[	        U5      S	:X  a1  SX'   US   [        US   5      S-
  4US   [        US   5      S-
  44nO[        S
US-   U4-  5      e[        U5       HS  u  nu  nn [        UU5      n[        [        [        U5      5      5      n[        UUU   5      nUR!                  U5        MU     M     [#        XX45      n[        UR$                  5      nUR'                  S5      nUR)                  SS5        UR)                  SUS-  5        UUl        UU[
        R*                  " SS/5      4$ s  snf ! , (       d  f       GN= fs  snf ! [         a    [        U[        US5      5      n Nf = f)zuPerform the actual data loading for the LFW pairs dataset

This operation is meant to be cached by a joblib wrapper.
rb	Nr   rL   r$   r   r      zinvalid line %d: %rzUTF-8zDifferent personszSame person)r7   decodestripsplitrY   rZ   r[   rX   listr]   rz   r   	TypeErrorstrrw   r   appendrr   shapepopinsertarray)index_file_pathr<   re   rf   r_   
index_filelnsplit_linessl
pair_specsn_pairsr:   rd   rn   
componentspairjnameidxperson_folder	filenamesro   pairsr   rl   s                            r@   _fetch_lfw_pairsr     sN    
ot	$
AKL2yy{((*006L 
%*:{c"gk"{J:*oG XXgS)FJ":.z?aFIAJqM 2Q 67AJqM 2Q 67D _!FIAJqM 2Q 67AJqM 2Q 67D
 2a!eZ5HHII'oNA{cK $%5t < VGM$:;<I]IcN;Ii( . /0 z59EEiilG	LLA	LLGqL!EK&"(($7#GHHHO M 
%	$:2  K $%5s47I JKs:   H,6H'H,H>-H>I'H,,
H; I&%I&>   testtrain10_folds)	subsetr'   r8   r_   rf   re   r9   r*   r+   r   c        	            [        UUUUUS9u  p[        R                  SX	5        [        U	SSS9nUR	                  [
        5      nSSSS	.nX;  a3  [        S
U < S[        [        UR                  5       5      5      < 35      e[        XU    5      nU" XX4US9u  nnn[        S5      n[        UR                  [        U5      S5      UUUUS9$ )a+  Load the Labeled Faces in the Wild (LFW) pairs dataset (classification).

Download it if necessary.

=================   =======================
Classes                                   2
Samples total                         13233
Dimensionality                         5828
Features            real, between 0 and 255
=================   =======================

In the `original paper <https://people.cs.umass.edu/~elm/papers/lfw.pdf>`_
the "pairs" version corresponds to the "restricted task", where
the experimenter should not use the name of a person to infer
the equivalence or non-equivalence of two face images that
are not explicitly given in the training set.

The original images are 250 x 250 pixels, but the default slice and resize
arguments reduce them to 62 x 47.

Read more in the :ref:`User Guide <labeled_faces_in_the_wild_dataset>`.

Parameters
----------
subset : {'train', 'test', '10_folds'}, default='train'
    Select the dataset to load: 'train' for the development training
    set, 'test' for the development test set, and '10_folds' for the
    official evaluation set that is meant to be used with a 10-folds
    cross validation.

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.

funneled : bool, default=True
    Download and use the funneled variant of the dataset.

resize : float, default=0.5
    Ratio used to resize the each face picture.

color : bool, default=False
    Keep the 3 RGB channels instead of averaging them to a single
    gray level channel. If color is True the shape of the data has
    one more dimension than the shape with color = False.

slice_ : tuple of slice, default=(slice(70, 195), slice(78, 172))
    Provide a custom 2D slice (height, width) to extract the
    'interesting' part of the jpeg files and avoid use statistical
    correlation from the background.

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.

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 of shape (2200, 5828). Shape depends on ``subset``.
        Each row corresponds to 2 ravel'd face images
        of original size 62 x 47 pixels.
        Changing the ``slice_``, ``resize`` or ``subset`` parameters
        will change the shape of the output.
    pairs : ndarray of shape (2200, 2, 62, 47). Shape depends on ``subset``
        Each row has 2 face images corresponding
        to same or different person from the dataset
        containing 5749 people. Changing the ``slice_``,
        ``resize`` or ``subset`` parameters will change the shape of the
        output.
    target : numpy array of shape (2200,). Shape depends on ``subset``.
        Labels associated to each pair of images.
        The two label values being different persons or the same person.
    target_names : numpy array of shape (2,)
        Explains the target values of the target array.
        0 corresponds to "Different person", 1 corresponds to "same person".
    DESCR : str
        Description of the Labeled Faces in the Wild (LFW) dataset.

Examples
--------
>>> from sklearn.datasets import fetch_lfw_pairs
>>> lfw_pairs_train = fetch_lfw_pairs(subset='train')
>>> list(lfw_pairs_train.target_names)
[np.str_('Different persons'), np.str_('Same person')]
>>> lfw_pairs_train.pairs.shape
(2200, 2, 62, 47)
>>> lfw_pairs_train.data.shape
(2200, 5828)
>>> lfw_pairs_train.target.shape
(2200,)
r   zLoading %s LFW pairs from %sr   r   r   r   r    r"   )r   r   r   zsubset='z' is invalid: should be one of )r_   rf   re   r   r   )r   r   r:   r   r   )rA   r0   r6   r   r   r   rz   r   rw   keysr   r   r   r   rY   )r   r'   r8   r_   rf   re   r9   r*   r+   r(   r<   r   r   label_filenamesr   r   r:   r   r   s                      r@   fetch_lfw_pairsr     s    B "2/"H LL/B 	1a8A()I %"O
 $tF?#7#7#9:;=
 	
 8V%<=O #,&f#E6< 	"F ]]3u:r*! r   )NTTr$   r%   )NFNr   )NFN)/__doc__loggingnumbersr   r   osr   r   r   r   os.pathr	   r
   r   numpyrZ   joblibr   utilsr   utils._param_validationr   r   r   r   utils.fixesr   _baser   r   r   r   	getLogger__name__r0   r4   r3   r/   rA   rr   r   r   rR   rQ   r   r   r   rF   r   r@   <module>r      sh    " 2 2 ' '    S S ,  
		8	$ 8O &8O  $<S
 #<S
 <S4 QT0&fBV ST('V 8T*KD!T)<dC!)(AtF!KT R&,' ){ kxD@A4d9=> #'" 
"cNE"cN+
^^N IM1Ih ;<=8T*KD!T)<dC&,' ){xD@A4d9=>
 #'  
"cNE"cN+
\\r   