§
    ¨éUg-w  ã                   ó|  — 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„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_matrixÚeye)Úeigshé   )ÚBaseEstimatorÚClassNamePrefixFeaturesOutMixinÚTransformerMixinÚ_fit_contextÚ_UnstableArchMixin)ÚNearestNeighbors)Úcheck_arrayÚcheck_random_state)Ú_init_arpack_v0)ÚIntervalÚ
StrOptionsÚvalidate_params)Ústable_cumsum)ÚFLOAT_DTYPESÚcheck_is_fittedçü©ñÒ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/surfInsights/venv3-11/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¬¦  «        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    ©r3   Ún_jobsF)Úreturn_distanceN©r1   r   )r$   )
r   ÚfitÚ_fit_XÚn_samples_fit_Ú
kneighborsr>   r%   Úaranger	   Úravel)	r.   r3   r1   rB   Úknnr2   r7   ÚdataÚindptrs	            r=   Úbarycenter_kneighbors_graphrN   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‘|”| S§Y¢Y¡[¤[°&Ð9À)ÈYÐAWÐXÑXÔXÐXr?   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   éÈ   é
   rO   Ú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_solverrX   Úmax_iterÚrandom_staterZ   Úeigen_valuesÚeigen_vectorsÚeÚindexs               r=   Ú
null_spacerm   }   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rS   Ústandardç-Cëâ6?çê-�™—q=)	r1   rf   rX   rg   ÚmethodÚhessian_tolÚmodified_tolrh   rB   c          	      ó²  — t          |dz   |¬¦  «        }|                     | ¦  «         |j        } | j        \  }}||k    rt	          d¦  «        ‚||k    rt	          d||fz  ¦  «        ‚|dk    }|dk    r›t          ||||¬¦  «        }|r7t          |j        d|j        iŽ|z
  }|j        |z   	                    ¦   «         }�	n�|j        |z  |j        z
  |z
   
                    ¦   «         }|j        d d |j        d	         dz   …xx         dz  cc<   �	n2|d
k    �rc||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<   t          j        ||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        t3          |¦  «        |k     ¦  «        <   ||z  }t          j        ||         ||         ¦  «        \  } }!|| |!fxx         t          j        ||j        ¦  «        z  cc<   �Œœ|rt7          |¦  «        }�nÈ|dk    �r)||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@          ¬¦  «        }.tC          |$d¦  «        }/|/d d …dd …f         |/d d …d d…f         z  dz
  }0t#          |¦  «        D ]%}t          j"        |0|d d d…f         |-¦  «        |.|<   Œ&|.||#z
  z  }.t          j        ||ft          j        ¬¦  «        }t#          |¦  «        D �]½}|.|         }1|"|d d …||1z
  d …f         }2t          j#         $                    |2                     d	¦  «        ¦  «        t          j%        |1¦  «        z  }3t          j&        |1|3¦  «        t          j        |2j        t          j        |¦  «        ¦  «        z
  }4t          j#         $                    |4¦  «        }5|5|	k     r|4d	z  }4n|4|5z  }4|2dt          j'        t          j        |2|4¦  «        |4¦  «        z  z
  d|3z
  |+|d d …d f         z  z   }6t          j        ||         ||         ¦  «        \  } }!|| |!fxx         t          j        |6|6j        ¦  «        z  cc<   |6                     d¦  «        }7||||         fxx         |7z  cc<   |||         |fxx         |7z  cc<   |||fxx         |1z  cc<   �Œ¿|rt7          |¦  «        }�n˜|dk    �r‘|                     | |dz   d¬¦  «        }|d d …dd …f         }t          j        ||f¦  «        }||k    }t#          |¦  «        D �];}| ||                  }8|8|8                     d	¦  «        z  }8|rt'          |8d¬¦  «        d	         }9n<t          j        |8|8j        ¦  «        }t+          |¦  «        d         d d …d d d…f         }9t          j        ||dz   f¦  «        }|9d 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         dz  cc<   �Œ=tQ          ||d||||
¬¦  «        S )Nr    rA   z>output dimension must be less than or equal to input dimensionzHExpected n_neighbors <= n_samples,  but n_samples = %d, n_neighbors = %drV   rn   )r3   r1   rB   Úformatr   Úhessianr   z^for method='hessian', n_neighbors must be greater than [n_components * (n_components + 3) / 2]F©r3   rC   r   )Úfull_matriceséÿÿÿÿÚmodifiedz1modified LLE requires n_neighbors >= n_componentsTr   Últsag      ð?)re   rf   rX   rg   rh   ))r   rE   rF   r$   r_   rN   r
   ru   r*   Útocsrr[   r,   rH   r%   r&   Úfloat64ÚzerosÚrangeÚmeanr   r)   r   r   r-   Úwhererb   Úmeshgridr	   ÚminÚ	transposer'   Úmedianr#   r   ÚsearchsortedÚlinalgÚnormÚsqrtÚfullÚouterrm   );r.   r3   Ún_componentsr1   rf   rX   rg   rq   rr   rs   rh   rB   ÚnbrsÚNÚd_inÚM_sparseÚWrc   ÚdpÚ	neighborsÚYiÚuse_svdr6   ÚGiÚUÚCiÚjrd   Ú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ÚXir5   ÚGiGiTs;                                                              r=   Ú_locally_linear_embeddingr¶   É   sµ  € õ ¨°a©ÀÐGÑGÔG€DØ‡H‚HˆQ�K„K€KØŒ€AàŒg�G€A€tà�dÒÐÝØLñ
ô 
ð 	
ð �aÒÐÝØVØ�+Ðññ
ô 
ð 	
ð
 ˜wÒ&€Hà�ÒÐÝ'Ø˜k¨s¸6ð
ñ 
ô 
ˆð ð 	+Ý�Q”WÐ. Q¤XÐ.Ð.°Ñ2ˆAØ”�q‘—’Ñ!Ô!ˆ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‰åŒH�a˜�V¥2¤:Ð.Ñ.Ô.ˆà Ò$ˆå�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¡¤Ñ/ÐÐÑÑàð 	Ý˜1‘”ˆAùà	�:Ò	Ñ	Ø˜Ò%Ð%ÝÐ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Ð(Ñ(Ô(ˆÝ$ U¨AÑ.Ô.ˆØ     B C C Ô(¨<¸¸¸¸3¸B¸3¸Ô+?Ñ?À!ÑCˆ	Ý�q‘”ð 	Bð 	BˆAÝœ¨°1°d°d¸°d°7Ô);¸SÑAÔAˆG�A‰JˆJØ�; Ñ$Ñ$ˆõ ŒH�a˜�V¥2¤:Ð.Ñ.Ô.ˆÝ�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Øˆa�˜1”ˆoÐÐÔ 'Ñ)ÐÐÑØˆi˜Œl˜AˆoÐÐÔ 'Ñ)ÐÐÑØˆa�ˆdˆGˆGŒG�s‰NˆGˆG‰G‰Gàð 	Ý˜1‘”ˆAùà	�6Ò	Ñ	Ø—O’OØ˜;¨™?¸Eð $ñ 
ô 
ˆ	ð ˜a˜a˜a   ˜eÔ$ˆ	åŒH�a˜�VÑÔˆà Ò$ˆå�q‘”ð 	/ñ 	/ˆ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Ð(Ð)Ð)Ô)¨QÑ.Ð)Ð)Ñ)Ñ)åØ	ØØØ!ØØØ!ðñ ô ð r?   z
array-likeÚleft©Úclosed>   rS   rV   rO   >   r{   rv   rz   rn   rh   ©r.   r3   rŒ   r1   rf   rX   rg   rq   rr   rs   rh   rB   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 %Ø
ØØ!ØØ!ØØØØØ!Ø!Øðñ ô ð r?   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   >   rS   rV   rO   >   r{   rv   rz   rn   >   rS   ÚbruteÚkd_treeÚ	ball_treerh   )r3   rŒ   r1   rf   rX   rg   rq   rr   rs   Úneighbors_algorithmrh   rB   Ú_parameter_constraintsé   r   r   rS   rP   rQ   rn   ro   rp   c                ó®   — || _         || _        || _        || _        || _        || _        || _        || _        |	| _        || _	        |
| _
        || _        d S ©N)r3   rŒ   r1   rf   rX   rg   rq   rr   rs   rh   rÄ   rB   )Úselfr3   rŒ   r1   rf   rX   rg   rq   rr   rs   rÄ   rh   rB   s                r=   Ú__init__zLocallyLinearEmbedding.__init__ô  sc   € ð  'ˆÔØ(ˆÔØˆŒØ(ˆÔØˆŒØ ˆŒØˆŒØ&ˆÔØ(ˆÔØ(ˆÔØ#6ˆÔ ØˆŒˆˆr?   c                 óÒ  — t          | j        | j        | j        ¬¦  «        | _        t          | j        ¦  «        }|                      |t          ¬¦  «        }| j         	                    |¦  «         t          | j        | j        | j        | j        | j        | j        | j        | j        | j        || j        | j        ¬¦  «        \  | _        | _        | j        j        d         | _        d S )N)r3   Ú	algorithmrB   r   )r.   r3   rŒ   rf   rX   rg   rq   rr   rs   rh   r1   rB   r    )r   r3   rÄ   rB   Únbrs_r   rh   Ú_validate_dataÚfloatrE   r¶   rŒ   rf   rX   rg   rq   rr   rs   r1   Ú
embedding_Úreconstruction_error_r$   Ú_n_features_out)rÉ   r.   rh   s      r=   Ú_fit_transformz%LocallyLinearEmbedding._fit_transform  sÞ   € Ý%ØÔ(ØÔ.Ø”;ð
ñ 
ô 
ˆŒ
õ *¨$Ô*;Ñ<Ô<ˆØ×Ò ­ÐÑ/Ô/ˆØŒ
�Š�qÑÔÐÝ6OØŒjØÔ(ØÔ*ØÔ*Ø”Ø”]Ø”;ØÔ(ØÔ*Ø%Ø”Ø”;ð7
ñ 7
ô 7
Ñ3ˆŒ˜Ô3ð  $œÔ4°QÔ7ˆÔÐÐr?   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É   r.   Úys      r=   rE   zLocallyLinearEmbedding.fit+  s   € ð" 	×Ò˜AÑÔÐØˆr?   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_transform?  s    € ð" 	×Ò˜AÑÔÐØŒÐr?   c                 óÈ  — 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)Úresetrw   rD   r   )r   rÎ   rÍ   rH   r3   r>   rF   r1   r%   r&   r$   rŒ   r   r)   rÐ   r*   )rÉ   r.   r7   ÚweightsÚX_newr6   s         r=   Ú	transformz LocallyLinearEmbedding.transformS  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Øˆr?   rÈ   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   r   rÅ   ÚdictÚ__annotations__rÊ   rÓ   r   rE   rØ   rÝ   © r?   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ðð&ð ð ð ð r?   rÀ   )r   )r   N)r    rO   rP   rQ   N),rá   Únumbersr   r   Únumpyr%   Úscipy.linalgr   r   r   r   Úscipy.sparser	   r
   Úscipy.sparse.linalgr   Úbaser   r   r   r   r   r“   r   Úutilsr   r   Úutils._arpackr   Úutils._param_validationr   r   r   Úutils.extmathr   Úutils.validationr   r   r>   rN   rm   r¶   r¾   rÀ   rä   r?   r=   ú<module>rð      s€  ðØ Ð ð #Ð "Ð "Ð "Ð "Ð "Ð "Ð "à Ð Ð Ð Ø -Ð -Ð -Ð -Ð -Ð -Ð -Ð -Ð -Ð -Ð -Ð -Ø (Ð (Ð (Ð (Ð (Ð (Ð (Ð (Ø %Ð %Ð %Ð %Ð %Ð %ðð ð ð ð ð ð ð ð ð ð ð ð ð ð )Ð (Ð (Ð (Ð (Ð (Ø 3Ð 3Ð 3Ð 3Ð 3Ð 3Ð 3Ð 3Ø +Ð +Ð +Ð +Ð +Ð +Ø KÐ KÐ KÐ KÐ KÐ KÐ KÐ KÐ KÐ KØ )Ð )Ð )Ð )Ð )Ð )Ø <Ð <Ð <Ð <Ð <Ð <Ð <Ð <ð3ð 3ð 3ð 3ðl'Yð 'Yð 'Yð 'YðV QUðIJð IJð IJð IJðb 	ØØØØØØØØðuð uð uð uð uðp €àÐ,Ð-Ø ˜ ¨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r?   