§
    rŠtjáx  ã                   ó�  — d Z ddlmZmZ ddlZddlmZmZm	Z	m
Z
 ddlmZmZ ddlmZ ddlmZmZmZmZmZ ddlmZ dd	lmZmZ dd
lmZ ddlmZmZm Z  ddl!m"Z" ddl#m$Z$m%Z% ddl&m'Z'm(Z(m)Z) d)d„Z*d*d„Z+	 d+d„Z,ddddddddddœ	d„Z- e deg eeddd¬¦  «        g eeddd¬¦  «        g eeddd¬¦  «        g eh d £¦  «        g eeddd¬¦  «        g eeddd¬¦  «        g eh d!£¦  «        g eeddd¬¦  «        g eeddd¬¦  «        gd"gdegd#œd$¬%¦  «        ddddddddddœ	d&„¦   «         Z. G d'„ d(eeee¦  «        Z/dS ),zLocally Linear Embeddingé    )ÚIntegralÚRealN)ÚeighÚqrÚsolveÚsvd)Ú	csr_arrayÚ	lil_array)Úeigsh)ÚBaseEstimatorÚClassNamePrefixFeaturesOutMixinÚTransformerMixinÚ_fit_contextÚ_UnstableArchMixin)ÚNearestNeighbors)Úcheck_arrayÚcheck_random_state)Ú_init_arpack_v0)ÚIntervalÚ
StrOptionsÚvalidate_params)Ú_align_api_if_sparse)ÚSCIPY_VERSION_BELOW_1_15Ú_sparse_eye_array)ÚFLOAT_DTYPESÚcheck_is_fittedÚvalidate_dataçü©ñÒMbP?c                 ó’  — t          | t          ¬¦  «        } t          |t          ¬¦  «        }t          |t          ¬¦  «        }|j        \  }}| j        d         |k    sJ ‚t	          j        ||f| j        ¬¦  «        }t	          j        || j        ¬¦  «        }t          |¦  «        D ]Ÿ\  }}	||	         }
|
| |         z
  }t	          j	        ||j
        ¦  «        }t	          j        |¦  «        }|dk    r||z  }n|}|j        dd|dz   …xx         |z  cc<   t          ||d¬¦  «        }|t	          j        |¦  «        z  ||dd…f<   Œ |S )aÙ  Compute barycenter weights of X from Y along the first axis

    We estimate the weights to assign to each point in Y[indices] to recover
    the point X[i]. The barycenter weights sum to 1.

    Parameters
    ----------
    X : array-like, shape (n_samples, n_dim)

    Y : array-like, shape (n_samples, n_dim)

    indices : array-like, shape (n_samples, n_dim)
            Indices of the points in Y used to compute the barycenter

    reg : float, default=1e-3
        Amount of regularization to add for the problem to be
        well-posed in the case of n_neighbors > n_dim

    Returns
    -------
    B : array-like, shape (n_samples, n_neighbors)

    Notes
    -----
    See developers note for more information.
    ©Údtyper   Né   Úpos)Úassume_a)r   r   ÚintÚshapeÚnpÚemptyr!   ÚonesÚ	enumerateÚdotÚTÚtraceÚflatr   Úsum)ÚXÚYÚindicesÚregÚ	n_samplesÚn_neighborsÚBÚvÚiÚindÚAÚCÚGr-   ÚRÚws                   ú^/var/www/html/CA-Chatbot/venv/lib/python3.11/site-packages/sklearn/manifold/_locally_linear.pyÚbarycenter_weightsr@      s[  € õ6 	�A�\Ð*Ñ*Ô*€AÝ�A�\Ð*Ñ*Ô*€AÝ˜'­Ð-Ñ-Ô-€Gà$œ]Ñ€Iˆ{ØŒ7�1Œ:˜Ò"Ð"Ð"Ð"å
Œ�)˜[Ð)°´Ð9Ñ9Ô9€AÝ
Œ� 1¤7Ð+Ñ+Ô+€Aõ ˜GÑ$Ô$ð  ð  ‰ˆˆ3ØˆcŒFˆØ��!”‰HˆÝŒF�1�a”c‰NŒNˆÝ”˜‘”ˆØ�1Š9ˆ9Ø�e‘ˆAˆAàˆAØ	ŒÐ!Ð!�+ ‘/Ð!Ð"Ð"Ô" aÑ'Ð"Ð"Ñ"Ý�!�Q Ð'Ñ'Ô'ˆØ•b”f˜Q‘i”i‘-ˆˆ!ˆQˆQˆQˆ$‰ˆØ€Hó    c                 ó¢  — t          |dz   |¬¦  «                             | ¦  «        }|j        } |j        }|                     | d¬¦  «        dd…dd…f         }t          | | ||¬¦  «        }t          j        d||z  dz   |¦  «        }t          | 	                    ¦   «         | 	                    ¦   «         |f||f¬¦  «        }	t          |	¦  «        S )	a-  Computes the barycenter weighted graph of k-Neighbors for points in X

    Parameters
    ----------
    X : {array-like, NearestNeighbors}
        Sample data, shape = (n_samples, n_features), in the form of a
        numpy array or a NearestNeighbors object.

    n_neighbors : int
        Number of neighbors for each sample.

    reg : float, default=1e-3
        Amount of regularization when solving the least-squares
        problem. Only relevant if mode='barycenter'. If None, use the
        default.

    n_jobs : int or None, default=None
        The number of parallel jobs to run for neighbors search.
        ``None`` means 1 unless in a :obj:`joblib.parallel_backend` context.
        ``-1`` means using all processors. See :term:`Glossary <n_jobs>`
        for more details.

    Returns
    -------
    A : sparse matrix in CSR format, shape = [n_samples, n_samples]
        A[i, j] is assigned the weight of edge that connects i to j.

    See Also
    --------
    sklearn.neighbors.kneighbors_graph
    sklearn.neighbors.radius_neighbors_graph
    r"   ©r5   Ún_jobsF)Úreturn_distanceN©r3   r   ©r&   )r   ÚfitÚ_fit_XÚn_samples_fit_Ú
kneighborsr@   r'   Úaranger	   Úravelr   )
r0   r5   r3   rD   Úknnr4   r9   ÚdataÚindptrÚcsrs
             r?   Úbarycenter_kneighbors_graphrR   S   sÍ   € õB  {°Q¡¸vÐ
FÑ
FÔ
F×
JÒ
JÈ1Ñ
MÔ
M€CØŒ
€AØÔ"€IØ
�.Š.˜¨Eˆ.Ñ
2Ô
2°1°1°1°a°b°b°5Ô
9€CÝ˜a  C¨SÐ1Ñ1Ô1€DÝŒY�q˜) kÑ1°AÑ5°{ÑCÔC€FÝ
�T—Z’Z‘\”\ 3§9¢9¡;¤;°Ð7À	È9Ð?UÐ
VÑ
VÔ
V€CÝ Ñ$Ô$Ð$rA   r"   Úarpackç�íµ ÷Æ°>éd   c                 ó¤  — |dk    r| j         d         dk    r||z   dk     rd}nd}|dk    r‡t          | j         d         |¦  «        }	 t          | ||z   d|||¬¦  «        \  }}	n%# t          $ r}
t	          d	|
z  ¦  «        |
‚d
}
~
ww xY w|	d
d
…|d
…f         t          j        ||d
…         ¦  «        fS |dk    r‡t          | d¦  «        r|                      ¦   «         } t          | |||z   dz
  fd¬¦  «        \  }}	t          j
        t          j        |¦  «        ¦  «        }|	d
d
…|f         t          j        |¦  «        fS t	          d|z  ¦  «        ‚)a0  
    Find the null space of a matrix M.

    Parameters
    ----------
    M : {array, matrix, sparse matrix, LinearOperator}
        Input covariance matrix: should be symmetric positive semi-definite

    k : int
        Number of eigenvalues/vectors to return

    k_skip : int, default=1
        Number of low eigenvalues to skip.

    eigen_solver : {'auto', 'arpack', 'dense'}, default='arpack'
        auto : algorithm will attempt to choose the best method for input data
        arpack : use arnoldi iteration in shift-invert mode.
                    For this method, M may be a dense matrix, sparse matrix,
                    or general linear operator.
                    Warning: ARPACK can be unstable for some problems.  It is
                    best to try several random seeds in order to check results.
        dense  : use standard dense matrix operations for the eigenvalue
                    decomposition.  For this method, M must be an array
                    or matrix type.  This method should be avoided for
                    large problems.

    tol : float, default=1e-6
        Tolerance for 'arpack' method.
        Not used if eigen_solver=='dense'.

    max_iter : int, default=100
        Maximum number of iterations for 'arpack' method.
        Not used if eigen_solver=='dense'

    random_state : int, RandomState instance, default=None
        Determines the random number generator when ``solver`` == 'arpack'.
        Pass an int for reproducible results across multiple function calls.
        See :term:`Glossary <random_state>`.
    Úautor   éÈ   é
   rS   Údenseg        )ÚsigmaÚtolÚmaxiterÚv0a	  Error in determining null-space with ARPACK. Error message: '%s'. Note that eigen_solver='arpack' can fail when the weight matrix is singular or otherwise ill-behaved. In that case, eigen_solver='dense' is recommended. See online documentation for more information.NÚtoarrayr"   T)Úsubset_by_indexÚoverwrite_azUnrecognized eigen_solver '%s')r&   r   r   ÚRuntimeErrorÚ
ValueErrorr'   r/   Úhasattrr_   r   ÚargsortÚabs)ÚMÚkÚk_skipÚeigen_solverr\   Úmax_iterÚrandom_stater^   Úeigen_valuesÚeigen_vectorsÚeÚindexs               r?   Ú
null_spacerq   ~   sª  € ðT �vÒÐØŒ7�1Œ:˜ÒÐ  F¡
¨R¢ Ø#ˆLˆLà"ˆLà�xÒÐÝ˜QœW QœZ¨Ñ6Ô6ˆð	Ý*/Ø�1�v‘: S¨c¸8Èð+ñ +ô +Ñ'ˆL˜-˜-øõ ð 	ð 	ð 	Ýð6ð 9:ñ	:ñô ð ðøøøøð	øøøð ˜Q˜Q˜Q   ˜ZÔ(­"¬&°¸f¸g¸gÔ1FÑ*GÔ*GÐGÐGØ	˜Ò	 Ð	 Ý�1�iÑ Ô ð 	Ø—	’	‘”ˆAÝ&*Ø ¨¨F©
°Q©Ð7ÀTð'
ñ '
ô '
Ñ#ˆ�mõ ”
�2œ6 ,Ñ/Ô/Ñ0Ô0ˆØ˜Q˜Q˜Q ˜XÔ&­¬¨|Ñ(<Ô(<Ð<Ð<åÐ9¸LÑHÑIÔIÐIs   ÁA$ Á$
BÁ.BÂBrW   Ústandardç-Cëâ6?çê-�™—q=)	r3   rj   r\   rk   ÚmethodÚhessian_tolÚmodified_tolrl   rD   c          	      óL  — t          |dz   |¬¦  «        }|                     | ¦  «         |j        } | j        \  }}||k    rt	          d¦  «        ‚||k    rt	          d||fz  ¦  «        ‚|dk    }|rt
          nt          j        }|dk    r�t          ||||¬¦  «        }|r+t          |j        |j
        |j        dœŽ|z
  }|j        |z  }�	n¢|j        |z  |j        z
  |z
                       ¦   «         }|j        d d |j        d	         dz   …xx         dz  cc<   �	nS|d
k    �rI||dz   z  dz  }|||z   k    rt	          d¦  «        ‚|                     | |dz   d¬¦  «        }|d d …dd …f         }t          j        |d|z   |z   ft          j        ¬¦  «        }d|d d …d	f<    |||ft          j        ¬¦  «        }||k    }t%          |¦  «        D �]š}| ||                  }||                     d	¦  «        z  }|rt)          |d	¬¦  «        d	         }n<t          j        ||j        ¦  «        }t-          |¦  «        d         d d …d d d…f         }|d d …d |…f         |d d …dd|z   …f<   d|z   }t%          |¦  «        D ]9}|d d …||dz   …f         |d d …||…f         z  |d d …|||z   |z
  …f<   |||z
  z  }Œ:t/          |¦  «        \  }}|d d …|dz   d …f         }|                     d	¦  «        } d| t          j        t5          | ¦  «        |k     ¦  «        <   || z  }t          j        ||         ||         ¦  «        \  }!}"||!|"fxx         t          j        ||j        ¦  «        z  cc<   �Œœ�n|dk    �rN||k     rt	          d¦  «        ‚|                     | |dz   d¬¦  «        }|d d …dd …f         }t          j        |||f¦  «        }#t9          ||¦  «        }$t          j        ||$g¦  «        }%||k    }|rJt%          |¦  «        D ]4}| ||                  | |         z
  }&t)          |&d¬¦  «        \  |#|<   |%|<   }'Œ5|%dz  }%nut%          |¦  «        D ]e}| ||                  | |         z
  }&t          j        |&|&j        ¦  «        }(t-          |(¦  «        \  })}*|)d d d…         |%|<   |*d d …d d d…f         |#|<   Œfd|%                     d¦  «        z  }t          j        |#                     d	dd¦  «        t          j        |¦  «        ¦  «        }+|+d d …d |$…fxx         |%|d d …d f         z   z  cc<   |+d d …|$d …fxx         |d d …d f         z  cc<   t          j        ||f¦  «        },t%          |¦  «        D ]&}t          j        |#|         |+|         ¦  «        |,|<   Œ'|,|,                     d¦  «        d d …d f         z  },|%d d …|d …f                              d¦  «        |%d d …d |…f                              d¦  «        z  }-t          j        |-¦  «        }.t          j        |t@          ¬¦  «        }/t          j!        |%d¦  «        }0|0d d …dd …f         |0d d …d d…f         z  dz
  }1t%          |¦  «        D ]%}t          j"        |1|d d d…f         |.¦  «        |/|<   Œ&|/||$z
  z  }/ |||ft          j        ¬¦  «        }t%          |¦  «        D �]÷}|/|         }2|#|d d …||2z
  d …f         }3t          j#         $                    |3                     d	¦  «        ¦  «        t          j%        |2¦  «        z  }4t          j&        |2|4¦  «        t          j        |3j        t          j        |¦  «        ¦  «        z
  }5t          j#         $                    |5¦  «        }6|6|	k     r|5d	z  }5n|5|6z  }5|3dt          j'        t          j        |3|5¦  «        |5¦  «        z  z
  d|4z
  |,|d d …d f         z  z   }7t          j        ||         ||         ¦  «        \  }!}"||!|"fxx         t          j        |7|7j        ¦  «        z  cc<   |7                     d¦  «        }8tP          r3||g||         fxx         |8z  cc<   |||         |gfxx         |8z  cc<   n0||||         fxx         |8z  cc<   |||         |fxx         |8z  cc<   |||fxx         |2z  cc<   �Œù�n®|dk    �r§|                     | |dz   d¬¦  «        }|d d …dd …f         } |||ft          j        ¬¦  «        }||k    }t%          |¦  «        D �]N}| ||                  }9|9|9                     d	¦  «        z  }9|rt)          |9d¬¦  «        d	         }:n<t          j        |9|9j        ¦  «        }t-          |¦  «        d         d d …d d d…f         }:t          j        ||dz   f¦  «        }|:d d …d |…f         |d d …dd …f<   dt          j%        |¦  «        z  |d d …d	f<   t          j        ||j        ¦  «        };t          j        ||         ||         ¦  «        \  }!}"||!|"fxx         |;z  cc<   |||         ||         fxx         t          j        |¬¦  «        z  cc<   �ŒP|r!tS          | *                    ¦   «         ¦  «        }tW          ||d||||
¬¦  «        S )Nr"   rC   z>output dimension must be less than or equal to input dimensionzFExpected n_neighbors < n_samples, but n_samples = %d, n_neighbors = %drZ   rr   )r5   r3   rD   )Úformatr!   r   Úhessiané   z^for method='hessian', n_neighbors must be greater than [n_components * (n_components + 3) / 2]F©r5   rE   r    )Úfull_matriceséÿÿÿÿÚmodifiedz1modified LLE requires n_neighbors >= n_componentsTr   Últsag      ð?rG   )ri   rj   r\   rk   rl   ),r   rH   rI   r&   rc   r
   r'   ÚzerosrR   r   ry   r!   r,   r_   r.   rK   r(   Úfloat64ÚrangeÚmeanr   r+   r   r   r/   Úwhererf   ÚmeshgridÚminÚ	transposer)   Úmedianr%   ÚcumsumÚsearchsortedÚlinalgÚnormÚsqrtÚfullÚouterr   r   Útocsrrq   )<r0   r5   Ún_componentsr3   rj   r\   rk   ru   rv   rw   rl   rD   ÚnbrsÚNÚd_inÚM_sparseÚM_container_constructorÚWrg   ÚdpÚ	neighborsÚYiÚuse_svdr8   ÚGiÚUÚCiÚjrh   ÚQr=   r>   ÚSÚnbrs_xÚnbrs_yÚVÚnevÚevalsÚX_nbrsÚ_ÚC_nbrsÚeviÚviÚtmpÚw_regÚrhoÚetaÚs_rangeÚevals_cumsumÚ	eta_rangeÚs_iÚViÚalpha_iÚhÚnorm_hÚWiÚWi_sum1ÚXir7   ÚGiGiTs<                                                               r?   Ú_locally_linear_embeddingr½   Ê   s9  € õ ¨°a©ÀÐGÑGÔG€DØ‡H‚HˆQ�K„K€KØŒ€AàŒg�G€A€tà�dÒÐÝØLñ
ô 
ð 	
ð �aÒÐÝØTØ�+Ðññ
ô 
ð 	
ð
 ˜wÒ&€HØ+3ÐA�i˜i½¼Ðà�ÒÐÝ'Ø˜k¨s¸6ð
ñ 
ô 
ˆð ð 	+Ý! 1¤7°1´8À1Ä7ÐKÐKÐKÈaÑOˆAØ”�a‘ˆA‰Aà”�q‘˜1œ3‘ Ñ"×+Ò+Ñ-Ô-ˆAØŒFÐ$Ð$�a”g˜a”j 1‘nÐ$Ð%Ð%Ô%¨Ñ*Ð%Ð%Ñ%Ñ%à	�9Ò	Ñ	Ø˜\¨AÑ-Ñ.°!Ñ3ˆà˜,¨Ñ+Ò+Ð+Ýð:ñô ð ð —O’OØ˜;¨™?¸Eð $ñ 
ô 
ˆ	ð ˜a˜a˜a   ˜eÔ$ˆ	åŒX�{ A¨Ñ$4°rÑ$9Ð:Å"Ä*ÐMÑMÔMˆØˆˆ1ˆ1ˆ1ˆaˆ4‰à#Ð# Q¨ Fµ"´*Ð=Ñ=Ô=ˆà Ò$ˆå�q‘”ð 	0ñ 	0ˆAØ�9˜Q”<”ˆBØ�"—'’'˜!‘*”*ÑˆBð ð )Ý˜¨!Ð,Ñ,Ô,¨QÔ/��å”V˜B ¤Ñ%Ô%�Ý˜‘H”H˜Q”K    4 4 R 4 Ô(�à*+¨A¨A¨A¨}°¨}Ð,<Ô*=ˆBˆqˆqˆq�!�a˜,Ñ&Ð&Ð&Ñ'à�LÑ ˆAÝ˜<Ñ(Ô(ð &ð &�Ø23°A°A°A°q¸1¸q¹5°y°L´/ÀAÀaÀaÀaÈÈ<ÈÐFWÔDXÑ2X��1�1�1�a˜!˜lÑ*¨QÑ.Ð.Ð.Ñ/Ø�\ AÑ%Ñ%��å�b‘6”6‰DˆAˆqà�!�!�!�\ AÑ%Ð'Ð'Ð'Ô(ˆAØ—’�a‘”ˆAà01ˆA�bŒh•s˜1‘v”v Ò+Ñ,Ô,Ñ-Ø�‰FˆAåœ[¨°1¬°yÀ´|ÑDÔD‰NˆF�FØˆf�fˆnÐÐÔ¥¤¨¨1¬3¡¤Ñ/ÐÐÑÑñ7	0ð: 
�:Ò	Ñ	Ø˜Ò%Ð%ÝÐPÑQÔQÐQà—O’OØ˜;¨™?¸Eð $ñ 
ô 
ˆ	ð ˜a˜a˜a   ˜eÔ$ˆ	õ
 ŒH�a˜ kÐ2Ñ3Ô3ˆÝ�$˜Ñ$Ô$ˆÝ”˜!˜S˜Ñ"Ô"ˆð  Ò$ˆàð 	#Ý˜1‘X”Xð Dð D�Ø˜9 Qœ<œ¨1¨Q¬4Ñ/�Ý$'¨¸dÐ$CÑ$CÔ$CÑ!��!‘�e˜A‘h  Ø�a‰KˆEˆEå˜1‘X”Xð #ð #�Ø˜9 Qœ<œ¨1¨Q¬4Ñ/�Ýœ ¨¬Ñ1Ô1�Ý˜v™,œ,‘��RØ˜t˜t ˜tœ9��a‘Ø˜!˜!˜!˜T˜T˜r˜T˜'”{��!‘�ð
 �U—Y’Y˜q‘\”\Ñ!ˆåŒf�Q—[’[  A qÑ)Ô)­2¬7°;Ñ+?Ô+?Ñ@Ô@ˆØˆAˆAˆAˆt�ˆtˆGˆˆŒ˜  A A A t G¤Ñ,Ñ,ˆˆ‰ØˆAˆAˆAˆsˆtˆtˆGˆˆŒ˜˜A˜A˜A˜t˜GœÑ$ˆˆ‰å”˜!˜[Ð)Ñ*Ô*ˆÝ�q‘”ð 	,ð 	,ˆAÝ”v˜a œd C¨¤FÑ+Ô+ˆE�!‰HˆHØ�—’˜1‘”˜a˜a˜a ˜gÔ&Ñ&ˆð �A�A�A�|�}�}Ð$Ô%×)Ò)¨!Ñ,Ô,¨u°Q°Q°Q¸¸¸Ð5EÔ/F×/JÒ/JÈ1Ñ/MÔ/MÑMˆÝŒi˜‰nŒnˆõ
 ”(˜1¥CÐ(Ñ(Ô(ˆÝ”y ¨Ñ*Ô*ˆØ     B C C Ô(¨<¸¸¸¸3¸B¸3¸Ô+?Ñ?À!ÑCˆ	Ý�q‘”ð 	Bð 	BˆAÝœ¨°1°d°d¸°d°7Ô);¸SÑAÔAˆG�A‰JˆJØ�; Ñ$Ñ$ˆð $Ð# Q¨ Fµ"´*Ð=Ñ=Ô=ˆå�q‘”ð (	ñ (	ˆAØ˜!”*ˆCð �1�a�a�a˜ sÑ*Ð,Ð,Ð,Ô-ˆBÝ”i—n’n R§V¢V¨A¡Y¤YÑ/Ô/µ"´'¸#±,´,Ñ>ˆGõ
 ”˜˜WÑ%Ô%­¬¨r¬tµR´W¸[Ñ5IÔ5IÑ(JÔ(JÑJˆAå”Y—^’^ AÑ&Ô&ˆFØ˜Ò$Ð$Ø�Q‘��à�V‘�ð �a�"œ(¥2¤6¨"¨a¡=¤=°!Ñ4Ô4Ñ4Ñ4¸¸G¹ÀuÈQÐPQÐPQÐPQÐSWÈZÔGXÑ7XÑXˆBõ  œ[¨°1¬°yÀ´|ÑDÔD‰NˆF�FØˆf�fˆnÐÐÔ¥¤¨¨B¬DÑ!1Ô!1Ñ1ÐÐÑØ—f’f˜Q‘i”iˆGÝ'ð .Ø�1�#�y ”|Ð#Ð$Ð$Ô$¨Ñ/Ð$Ð$Ñ$Ø�)˜A”,  Ð#Ð$Ð$Ô$¨Ñ/Ð$Ð$Ñ$Ð$à�!�Y˜q”\�/Ð"Ð"Ô" gÑ-Ð"Ð"Ñ"Ø�)˜A”, �/Ð"Ð"Ô" gÑ-Ð"Ð"Ñ"Øˆa�ˆdˆGˆGŒG�s‰NˆGˆG‰G‰GñQ(	ðT 
�6Ò	Ñ	Ø—O’OØ˜;¨™?¸Eð $ñ 
ô 
ˆ	ð ˜a˜a˜a   ˜eÔ$ˆ	à#Ð# Q¨ Fµ"´*Ð=Ñ=Ô=ˆà Ò$ˆå�q‘”ð 	Hñ 	HˆAØ�9˜Q”<”ˆBØ�"—'’'˜!‘*”*ÑˆBð ð )Ý˜¨$Ð/Ñ/Ô/°Ô2��å”V˜B ¤Ñ%Ô%�Ý˜‘H”H˜Q”K    4 4 R 4 Ô(�å”˜;¨°qÑ(8Ð9Ñ:Ô:ˆBØ˜!˜!˜!˜]˜l˜]Ð*Ô+ˆBˆqˆqˆq�!�"�"ˆu‰IØ�RœW [Ñ1Ô1Ñ1ˆBˆqˆqˆq�!ˆt‰Hå”F˜2˜rœtÑ$Ô$ˆEåœ[¨°1¬°yÀ´|ÑDÔD‰NˆF�FØˆf�fˆnÐÐÔ Ñ&ÐÐÑàˆi˜Œl˜I aœLÐ(Ð)Ð)Ô)­R¬W¸;Ð-GÑ-GÔ-GÑGÐ)Ð)Ñ)Ñ)àð ,Ý  §¢¡¤Ñ+Ô+ˆåØ	ØØØ!ØØØ!ðñ ô ð rA   z
array-likeÚleft©Úclosed>   rW   rZ   rS   >   r€   rz   r   rr   rl   ©r0   r5   r’   r3   rj   r\   rk   ru   rv   rw   rl   rD   T©Úprefer_skip_nested_validationc                ó8   — t          | |||||||||	|
|¬¦  «        S )a³  Perform a Locally Linear Embedding analysis on the data.

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

    Parameters
    ----------
    X : {array-like, NearestNeighbors}
        Sample data, shape = (n_samples, n_features), in the form of a
        numpy array or a NearestNeighbors object.

    n_neighbors : int
        Number of neighbors to consider for each point.

    n_components : int
        Number of coordinates for the manifold.

    reg : float, default=1e-3
        Regularization constant, multiplies the trace of the local covariance
        matrix of the distances.

    eigen_solver : {'auto', 'arpack', 'dense'}, default='auto'
        auto : algorithm will attempt to choose the best method for input data

        arpack : use arnoldi iteration in shift-invert mode.
                    For this method, M may be a dense matrix, sparse matrix,
                    or general linear operator.
                    Warning: ARPACK can be unstable for some problems.  It is
                    best to try several random seeds in order to check results.

        dense  : use standard dense matrix operations for the eigenvalue
                    decomposition.  For this method, M must be an array
                    or matrix type.  This method should be avoided for
                    large problems.

    tol : float, default=1e-6
        Tolerance for 'arpack' method
        Not used if eigen_solver=='dense'.

    max_iter : int, default=100
        Maximum number of iterations for the arpack solver.

    method : {'standard', 'hessian', 'modified', 'ltsa'}, default='standard'
        standard : use the standard locally linear embedding algorithm.
                   see reference [1]_
        hessian  : use the Hessian eigenmap method.  This method requires
                   n_neighbors > n_components * (1 + (n_components + 1) / 2.
                   see reference [2]_
        modified : use the modified locally linear embedding algorithm.
                   see reference [3]_
        ltsa     : use local tangent space alignment algorithm
                   see reference [4]_

    hessian_tol : float, default=1e-4
        Tolerance for Hessian eigenmapping method.
        Only used if method == 'hessian'.

    modified_tol : float, default=1e-12
        Tolerance for modified LLE method.
        Only used if method == 'modified'.

    random_state : int, RandomState instance, default=None
        Determines the random number generator when ``solver`` == 'arpack'.
        Pass an int for reproducible results across multiple function calls.
        See :term:`Glossary <random_state>`.

    n_jobs : int or None, default=None
        The number of parallel jobs to run for neighbors search.
        ``None`` means 1 unless in a :obj:`joblib.parallel_backend` context.
        ``-1`` means using all processors. See :term:`Glossary <n_jobs>`
        for more details.

    Returns
    -------
    Y : ndarray of shape (n_samples, n_components)
        Embedding vectors.

    squared_error : float
        Reconstruction error for the embedding vectors. Equivalent to
        ``norm(Y - W Y, 'fro')**2``, where W are the reconstruction weights.

    References
    ----------

    .. [1] Roweis, S. & Saul, L. Nonlinear dimensionality reduction
        by locally linear embedding.  Science 290:2323 (2000).
    .. [2] Donoho, D. & Grimes, C. Hessian eigenmaps: Locally
        linear embedding techniques for high-dimensional data.
        Proc Natl Acad Sci U S A.  100:5591 (2003).
    .. [3] `Zhang, Z. & Wang, J. MLLE: Modified Locally Linear
        Embedding Using Multiple Weights.
        <https://citeseerx.ist.psu.edu/doc_view/pid/0b060fdbd92cbcc66b383bcaa9ba5e5e624d7ee3>`_
    .. [4] Zhang, Z. & Zha, H. Principal manifolds and nonlinear
        dimensionality reduction via tangent space alignment.
        Journal of Shanghai Univ.  8:406 (2004)

    Examples
    --------
    >>> from sklearn.datasets import load_digits
    >>> from sklearn.manifold import locally_linear_embedding
    >>> X, _ = load_digits(return_X_y=True)
    >>> X.shape
    (1797, 64)
    >>> embedding, _ = locally_linear_embedding(X[:100],n_neighbors=5, n_components=2)
    >>> embedding.shape
    (100, 2)
    rÁ   )r½   rÁ   s               r?   Úlocally_linear_embeddingrÅ   Æ  s@   € õT %Ø
ØØ!ØØ!ØØØØØ!Ø!Øðñ ô ð rA   c                   óÔ  — e Zd ZU dZ eeddd¬¦  «        g eeddd¬¦  «        g eeddd¬¦  «        g eh d£¦  «        g eeddd¬¦  «        g eeddd¬¦  «        g eh d£¦  «        g eeddd¬¦  «        g eeddd¬¦  «        g eh d	£¦  «        gd
gdegdœZe	e
d<   dddddddddddddœd„Zd„ Z ed¬¦  «        dd„¦   «         Z ed¬¦  «        dd„¦   «         Zd„ ZdS )ÚLocallyLinearEmbeddinga€  Locally Linear Embedding.

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

    Parameters
    ----------
    n_neighbors : int, default=5
        Number of neighbors to consider for each point.

    n_components : int, default=2
        Number of coordinates for the manifold.

    reg : float, default=1e-3
        Regularization constant, multiplies the trace of the local covariance
        matrix of the distances.

    eigen_solver : {'auto', 'arpack', 'dense'}, default='auto'
        The solver used to compute the eigenvectors. The available options are:

        - `'auto'` : algorithm will attempt to choose the best method for input
          data.
        - `'arpack'` : use arnoldi iteration in shift-invert mode. For this
          method, M may be a dense matrix, sparse matrix, or general linear
          operator.
        - `'dense'`  : use standard dense matrix operations for the eigenvalue
          decomposition. For this method, M must be an array or matrix type.
          This method should be avoided for large problems.

        .. warning::
           ARPACK can be unstable for some problems.  It is best to try several
           random seeds in order to check results.

    tol : float, default=1e-6
        Tolerance for 'arpack' method
        Not used if eigen_solver=='dense'.

    max_iter : int, default=100
        Maximum number of iterations for the arpack solver.
        Not used if eigen_solver=='dense'.

    method : {'standard', 'hessian', 'modified', 'ltsa'}, default='standard'
        - `standard`: use the standard locally linear embedding algorithm. see
          reference [1]_
        - `hessian`: use the Hessian eigenmap method. This method requires
          ``n_neighbors > n_components * (1 + (n_components + 1) / 2``. see
          reference [2]_
        - `modified`: use the modified locally linear embedding algorithm.
          see reference [3]_
        - `ltsa`: use local tangent space alignment algorithm. see
          reference [4]_

    hessian_tol : float, default=1e-4
        Tolerance for Hessian eigenmapping method.
        Only used if ``method == 'hessian'``.

    modified_tol : float, default=1e-12
        Tolerance for modified LLE method.
        Only used if ``method == 'modified'``.

    neighbors_algorithm : {'auto', 'brute', 'kd_tree', 'ball_tree'},                           default='auto'
        Algorithm to use for nearest neighbors search, passed to
        :class:`~sklearn.neighbors.NearestNeighbors` instance.

    random_state : int, RandomState instance, default=None
        Determines the random number generator when
        ``eigen_solver`` == 'arpack'. Pass an int for reproducible results
        across multiple function calls. See :term:`Glossary <random_state>`.

    n_jobs : int or None, default=None
        The number of parallel jobs to run.
        ``None`` means 1 unless in a :obj:`joblib.parallel_backend` context.
        ``-1`` means using all processors. See :term:`Glossary <n_jobs>`
        for more details.

    Attributes
    ----------
    embedding_ : array-like, shape [n_samples, n_components]
        Stores the embedding vectors

    reconstruction_error_ : float
        Reconstruction error associated with `embedding_`

    n_features_in_ : int
        Number of features seen during :term:`fit`.

        .. versionadded:: 0.24

    feature_names_in_ : ndarray of shape (`n_features_in_`,)
        Names of features seen during :term:`fit`. Defined only when `X`
        has feature names that are all strings.

        .. versionadded:: 1.0

    nbrs_ : NearestNeighbors object
        Stores nearest neighbors instance, including BallTree or KDtree
        if applicable.

    See Also
    --------
    SpectralEmbedding : Spectral embedding for non-linear dimensionality
        reduction.
    TSNE : Distributed Stochastic Neighbor Embedding.

    References
    ----------

    .. [1] Roweis, S. & Saul, L. Nonlinear dimensionality reduction
        by locally linear embedding.  Science 290:2323 (2000).
    .. [2] Donoho, D. & Grimes, C. Hessian eigenmaps: Locally
        linear embedding techniques for high-dimensional data.
        Proc Natl Acad Sci U S A.  100:5591 (2003).
    .. [3] `Zhang, Z. & Wang, J. MLLE: Modified Locally Linear
        Embedding Using Multiple Weights.
        <https://citeseerx.ist.psu.edu/doc_view/pid/0b060fdbd92cbcc66b383bcaa9ba5e5e624d7ee3>`_
    .. [4] Zhang, Z. & Zha, H. Principal manifolds and nonlinear
        dimensionality reduction via tangent space alignment.
        Journal of Shanghai Univ.  8:406 (2004)

    Examples
    --------
    >>> from sklearn.datasets import load_digits
    >>> from sklearn.manifold import LocallyLinearEmbedding
    >>> X, _ = load_digits(return_X_y=True)
    >>> X.shape
    (1797, 64)
    >>> embedding = LocallyLinearEmbedding(n_components=2)
    >>> X_transformed = embedding.fit_transform(X[:100])
    >>> X_transformed.shape
    (100, 2)
    r"   Nr¾   r¿   r   >   rW   rZ   rS   >   r€   rz   r   rr   >   rW   ÚbruteÚkd_treeÚ	ball_treerl   )r5   r’   r3   rj   r\   rk   ru   rv   rw   Úneighbors_algorithmrl   rD   Ú_parameter_constraintsé   r{   r   rW   rT   rU   rr   rs   rt   c                ó®   — || _         || _        || _        || _        || _        || _        || _        || _        |	| _        || _	        |
| _
        || _        d S ©N)r5   r’   r3   rj   r\   rk   ru   rv   rw   rl   rË   rD   )Úselfr5   r’   r3   rj   r\   rk   ru   rv   rw   rË   rl   rD   s                r?   Ú__init__zLocallyLinearEmbedding.__init__ù  sc   € ð  'ˆÔØ(ˆÔØˆŒØ(ˆÔØˆŒØ ˆŒØˆŒØ&ˆÔØ(ˆÔØ(ˆÔØ#6ˆÔ ØˆŒˆˆrA   c                 óÈ  — t          | j        | j        | j        ¬¦  «        | _        t          | j        ¦  «        }t          | |t          ¬¦  «        }| j         	                    |¦  «         t          | j        | j        | j        | j        | j        | j        | j        | j        | j        || j        | j        ¬¦  «        \  | _        | _        | j        j        d         | _        d S )N)r5   Ú	algorithmrD   r    )r0   r5   r’   rj   r\   rk   ru   rv   rw   rl   r3   rD   r"   )r   r5   rË   rD   Únbrs_r   rl   r   ÚfloatrH   r½   r’   rj   r\   rk   ru   rv   rw   r3   Ú
embedding_Úreconstruction_error_r&   Ú_n_features_out)rÐ   r0   rl   s      r?   Ú_fit_transformz%LocallyLinearEmbedding._fit_transform  sÚ   € Ý%ØÔ(ØÔ.Ø”;ð
ñ 
ô 
ˆŒ
õ *¨$Ô*;Ñ<Ô<ˆÝ˜$ ­Ð/Ñ/Ô/ˆØŒ
�Š�qÑÔÐÝ6OØŒjØÔ(ØÔ*ØÔ*Ø”Ø”]Ø”;ØÔ(ØÔ*Ø%Ø”Ø”;ð7
ñ 7
ô 7
Ñ3ˆŒ˜Ô3ð  $œÔ4°QÔ7ˆÔÐÐrA   TrÂ   c                 ó0   — |                       |¦  «         | S )ay  Compute the embedding vectors for data X.

        Parameters
        ----------
        X : array-like of shape (n_samples, n_features)
            Training set.

        y : Ignored
            Not used, present here for API consistency by convention.

        Returns
        -------
        self : object
            Fitted `LocallyLinearEmbedding` class instance.
        )rÙ   ©rÐ   r0   Úys      r?   rH   zLocallyLinearEmbedding.fit0  s   € ð" 	×Ò˜AÑÔÐØˆrA   c                 ó:   — |                       |¦  «         | j        S )aœ  Compute the embedding vectors for data X and transform X.

        Parameters
        ----------
        X : array-like of shape (n_samples, n_features)
            Training set.

        y : Ignored
            Not used, present here for API consistency by convention.

        Returns
        -------
        X_new : array-like, shape (n_samples, n_components)
            Returns the instance itself.
        )rÙ   rÖ   rÛ   s      r?   Úfit_transformz$LocallyLinearEmbedding.fit_transformD  s    € ð" 	×Ò˜AÑÔÐØŒÐrA   c                 ó¾  — t          | ¦  «         t          | |d¬¦  «        }| j                             || j        d¬¦  «        }t          || j        j        || j        ¬¦  «        }t          j	        |j
        d         | j        f¦  «        }t          |j
        d         ¦  «        D ]6}t          j        | j        ||                  j        ||         ¦  «        ||<   Œ7|S )að  
        Transform new points into embedding space.

        Parameters
        ----------
        X : array-like of shape (n_samples, n_features)
            Training set.

        Returns
        -------
        X_new : ndarray of shape (n_samples, n_components)
            Returns the instance itself.

        Notes
        -----
        Because of scaling performed by this method, it is discouraged to use
        it together with methods that are not scale-invariant (like SVMs).
        F)Úresetr|   rF   r   )r   r   rÔ   rK   r5   r@   rI   r3   r'   r(   r&   r’   rƒ   r+   rÖ   r,   )rÐ   r0   r9   ÚweightsÚX_newr8   s         r?   Ú	transformz LocallyLinearEmbedding.transformX  sÕ   € õ& 	˜ÑÔÐå˜$ ¨Ð/Ñ/Ô/ˆØŒj×#Ò#Ø˜4Ô+¸Uð $ñ 
ô 
ˆõ % Q¨¬
Ô(9¸3ÀDÄHÐMÑMÔMˆÝ”˜!œ' !œ* dÔ&7Ð8Ñ9Ô9ˆÝ�q”w˜q”zÑ"Ô"ð 	Eð 	EˆAÝ”v˜dœo¨c°!¬fÔ5Ô7¸À¼ÑDÔDˆE�!‰HˆHØˆrA   rÏ   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   r   rÌ   ÚdictÚ__annotations__rÑ   rÙ   r   rH   rÞ   rã   © rA   r?   rÇ   rÇ   `  sþ  € € € € € € ðBð BðJ !˜ ¨1¨d¸6ÐBÑBÔBÐCØ!˜ (¨A¨t¸FÐCÑCÔCÐDØ�˜˜q $¨vÐ6Ñ6Ô6Ð7Ø#˜Ð$?Ð$?Ð$?Ñ@Ô@ÐAØ�˜˜q $¨vÐ6Ñ6Ô6Ð7Ø�X˜h¨¨4¸Ð?Ñ?Ô?Ð@Ø�:ÐIÐIÐIÑJÔJÐKØ ˜  q¨$°vÐ>Ñ>Ô>Ð?Ø!˜ $¨¨4¸Ð?Ñ?Ô?Ð@Ø * 
Ð+TÐ+TÐ+TÑ UÔ UÐVØ'Ð(Ø˜Ð"ð$ð $Ð˜Dð ð ñ ð$ ØØØØØØØØØ"ØØðð ð ð ð ð:8ð 8ð 8ð4 €\°Ð5Ñ5Ô5ðð ð ñ 6Ô5ðð& €\°Ð5Ñ5Ô5ðð ð ñ 6Ô5ðð&ð ð ð ð rA   rÇ   )r   )r   N)r"   rS   rT   rU   N)0rç   Únumbersr   r   Únumpyr'   Úscipy.linalgr   r   r   r   Úscipy.sparser	   r
   Úscipy.sparse.linalgr   Úsklearn.baser   r   r   r   r   Úsklearn.neighborsr   Úsklearn.utilsr   r   Úsklearn.utils._arpackr   Úsklearn.utils._param_validationr   r   r   Úsklearn.utils._sparser   Úsklearn.utils.fixesr   r   Úsklearn.utils.validationr   r   r   r@   rR   rq   r½   rÅ   rÇ   rê   rA   r?   ú<module>rø      sš  ðØ Ð ð
 #Ð "Ð "Ð "Ð "Ð "Ð "Ð "à Ð Ð Ð Ø -Ð -Ð -Ð -Ð -Ð -Ð -Ð -Ð -Ð -Ð -Ð -Ø -Ð -Ð -Ð -Ð -Ð -Ð -Ð -Ø %Ð %Ð %Ð %Ð %Ð %ðð ð ð ð ð ð ð ð ð ð ð ð ð ð /Ð .Ð .Ð .Ð .Ð .Ø 9Ð 9Ð 9Ð 9Ð 9Ð 9Ð 9Ð 9Ø 1Ð 1Ð 1Ð 1Ð 1Ð 1Ø QÐ QÐ QÐ QÐ QÐ QÐ QÐ QÐ QÐ QØ 6Ð 6Ð 6Ð 6Ð 6Ð 6Ø KÐ KÐ KÐ KÐ KÐ KÐ KÐ KØ QÐ QÐ QÐ QÐ QÐ QÐ QÐ QÐ QÐ Qð3ð 3ð 3ð 3ðl(%ð (%ð (%ð (%ðX QUðIJð IJð IJð IJðb 	ØØØØØØØØðyð yð yð yð yðx €àÐ,Ð-Ø ˜ ¨1¨d¸6ÐBÑBÔBÐCØ!˜ (¨A¨t¸FÐCÑCÔCÐDØ�˜˜q $¨vÐ6Ñ6Ô6Ð7Ø#˜Ð$?Ð$?Ð$?Ñ@Ô@ÐAØ�˜˜q $¨vÐ6Ñ6Ô6Ð7Ø�X˜h¨¨4¸Ð?Ñ?Ô?Ð@Ø�:ÐIÐIÐIÑJÔJÐKØ ˜  q¨$°vÐ>Ñ>Ô>Ð?Ø!˜ $¨¨4¸Ð?Ñ?Ô?Ð@Ø'Ð(Ø˜Ð"ðð ð #'ðñ ô ð, 	ØØØØØØØØðFð Fð Fð Fñ#ô ð"FðRUð Uð Uð Uð UØ#ØØØñ	Uô Uð Uð Uð UrA   