Ë
    ÜÍ:jáx  ã                   óF  — 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/y)+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kD  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                   úu/home/mcse/projects/srt_converter/srt-converter-venv/lib/python3.12/site-packages/sklearn/manifold/_locally_linear.pyÚbarycenter_weightsr@      s*  € ô6 	�Aœ\Ô*€AÜ�Aœ\Ô*€AÜ˜'¬Ô-€Gà$Ÿ]™]Ñ€Iˆ{Ø�7‰7�1‰:˜Ò"Ð"Ð"ä
�‰�)˜[Ð)°·±Ô9€AÜ
�‰� 1§7¡7Ô+€Aô ˜GÓ$ò  ‰ˆˆ3Øˆc‰FˆØ��!‘‰HˆÜ�F‰F�1�a—c‘c‹NˆÜ—‘˜“ˆØ�1Š9Ø�e‘‰AàˆAØ	�‰Ñ!�+ ‘/Ð!Ó" aÑ'Ó"Ü�!�Q Ô'ˆØ”b—f‘f˜Q“i‘-ˆˆ!ŠQˆ$Šð ð €Hó    c                 ór  — t        |dz   |¬«      j                  | «      }|j                  } |j                  }|j	                  | d¬«      dd…dd…f   }t        | | ||¬«      }t        j                  d||z  dz   |«      }t        |j                  «       |j                  «       |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×
JÑ
JÈ1Ó
M€CØ�
‰
€AØ×"Ñ"€IØ
�.‰.˜¨Eˆ.Ó
2²1°a±b°5Ñ
9€CÜ˜a  C¨SÔ1€DÜ�Y‰Y�q˜) kÑ1°AÑ5°{ÓC€FÜ
�T—Z‘Z“\ 3§9¡9£;°Ð7À	È9Ð?UÔ
V€CÜ Ó$Ð$rA   r"   ç�íµ ÷Æ°>éd   c                 óX  — |dk(  r| j                   d   dkD  r||z   dk  rd}nd}|dk(  rTt        | j                   d   |«      }	 t        | ||z   d|||¬«      \  }}	|	d
d
…|d
…f   t        j                  ||d
 «      fS |dk(  r{t        | d«      r| j                  «       } t        | |||z   dz
  fd¬«      \  }}	t        j                  t        j                  |«      «      }|	d
d
…|f   t        j                  |«      fS t	        d|z  «      ‚# t        $ r}
t	        d	|
z  «      |
‚d
}
~
ww xY w)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   éÈ   é
   ÚarpackÚ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   ~   sT  € ðT �vÒØ�7‰7�1‰:˜Ò  F¡
¨R¢Ø#‰Là"ˆLà�xÒÜ˜QŸW™W Q™Z¨Ó6ˆð	Ü*/Ø�1�v‘: S¨c¸8Èô+Ñ'ˆL˜-ð šQ ¡˜ZÑ(¬"¯&©&°¸f¸gÐ1FÓ*GÐGÐGØ	˜Ò	 Ü�1�iÔ Ø—	‘	“ˆAÜ&*Ø ¨¨F©
°Q©Ð7ÀTô'
Ñ#ˆ�mô —
‘
œ2Ÿ6™6 ,Ó/Ó0ˆØšQ ˜XÑ&¬¯©¨|Ó(<Ð<Ð<äÐ9¸LÑHÓIÐIøô' ò 	Üð6ð 9:ñ	:óð ðûð	ús   ÁD Ä	D)ÄD$Ä$D)rV   Ústandardç-Cëâ6?çê-�™—q=)	r3   rj   r\   rk   ÚmethodÚhessian_tolÚmodified_tolrl   rD   c          	      ó|  — t        |dz   |¬«      }|j                  | «       |j                  } | j                  \  }}||kD  rt	        d«      ‚||k\  rt	        d||fz  «      ‚|dk7  }|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                  «       }|j                  d d |j                  d	   dz   …xx   dz  cc<   �ne|d
k(  �r||dz   z  dz  }|||z   k  rt	        d«      ‚|j                  | |dz   d¬«      }|d d …dd …f   }t        j                   |d|z   |z   ft        j"                  ¬«      }d|d d …d	f<    |||ft        j"                  ¬«      }||kD  }t%        |«      D �]i  }| ||      }||j'                  d	«      z  }|rt)        |d	¬«      d	   }n8t        j*                  ||j                  «      }t-        |«      d   d d …d d d…f   }|d d …d |…f   |d d …dd|z   …f<   d|z   }t%        |«      D ]3  }|d d …||dz   …f   |d d …||…f   z  |d d …|||z   |z
  …f<   |||z
  z  }Œ5 t/        |«      \  }}|d d …|dz   d …f   }|j1                  d	«      } d| t        j2                  t5        | «      |k  «      <   || z  }t        j6                  ||   ||   «      \  }!}"||!|"fxx   t        j*                  ||j                  «      z  cc<   �Œl �nP|dk(  �rÆ||k  rt	        d«      ‚|j                  | |dz   d¬«      }|d d …dd …f   }t        j                  |||f«      }#t9        ||«      }$t        j                  ||$g«      }%||kD  }|r;t%        |«      D ]'  }| ||      | |   z
  }&t)        |&d¬«      \  |#|<   |%|<   }'Œ) |%dz  }%nft%        |«      D ]X  }| ||      | |   z
  }&t        j*                  |&|&j                  «      }(t-        |(«      \  })}*|)d d d…   |%|<   |*d d …d d d…f   |#|<   ŒZ d|%j1                  d«      z  }t        j*                  |#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*                  |#|   |+|   «      |,|<   Œ# |,|,j1                  d«      d d …d f   z  },|%d d …|d …f   j1                  d«      |%d d …d |…f   j1                  d«      z  }-t        j>                  |-«      }.t        j                  |t@        ¬«      }/t        jB                  |%d«      }0|0d d …dd …f   |0d d …d d…f   z  dz
  }1t%        |«      D ]#  }t        jD                  |1|d d d…f   |.«      |/|<   Œ% |/||$z
  z  }/ |||ft        j"                  ¬«      }t%        |«      D �]Ò  }|/|   }2|#|d d …||2z
  d …f   }3t        jF                  jI                  |3j1                  d	«      «      t        jJ                  |2«      z  }4t        jL                  |2|4«      t        j*                  |3j                  t        j<                  |«      «      z
  }5t        jF                  jI                  |5«      }6|6|	k  r|5d	z  }5n|5|6z  }5|3dt        jN                  t        j*                  |3|5«      |5«      z  z
  d|4z
  |,|d d …d f   z  z   }7t        j6                  ||   ||   «      \  }!}"||!|"fxx   t        j*                  |7|7j                  «      z  cc<   |7j1                  d«      }8tP        r'||g||   fxx   |8z  cc<   |||   |gfxx   |8z  cc<   n$||||   fxx   |8z  cc<   |||   |fxx   |8z  cc<   |||fxx   |2z  cc<   �ŒÕ �n„|dk(  �r~|j                  | |dz   d¬«      }|d d …dd …f   } |||ft        j"                  ¬«      }||kD  }t%        |«      D �].  }| ||      }9|9|9j'                  d	«      z  }9|rt)        |9d¬«      d	   }:n8t        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        jJ                  |«      z  |d d …d	f<   t        j*                  ||j                  «      };t        j6                  ||   ||   «      \  }!}"||!|"fxx   |;z  cc<   |||   ||   fxx   t        j<                  |¬«      z  cc<   �Œ1 |rtS        jU                  «       «      }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½   Ê   s
  € ô ¨°a©ÀÔG€DØ‡H�HˆQ„KØ�‰€Aà�g‰g�G€A€tà�dÒÜØLó
ð 	
ð �aÒÜØTØ�+Ðñó
ð 	
ð
 ˜wÑ&€HÙ+3�i¼¿¹Ðà�ÒÜ'Ø˜k¨s¸6ô
ˆñ Ü! 1§7¡7°1·8±8À1Ç7Á7ÒKÈaÑOˆAØ—‘�a‘ŠAà—‘�q‘˜1Ÿ3™3‘ Ñ"×+Ñ+Ó-ˆAØ�F‰FÑ$�a—g‘g˜a‘j 1‘nÐ$Ó%¨Ñ*Õ%à	�9Ó	Ø˜\¨AÑ-Ñ.°!Ñ3ˆà˜,¨Ñ+Ò+Üð:óð ð —O‘OØ˜;¨™?¸Eð $ó 
ˆ	ð ša ¡˜eÑ$ˆ	ä�X‰X�{ A¨Ñ$4°rÑ$9Ð:Ä"Ç*Á*ÔMˆØˆŠ1ˆaˆ4‰á# Q¨ F´"·*±*Ô=ˆà Ñ$ˆä�q“ó 	0ˆAØ�9˜Q‘<‘ˆBØ�"—'‘'˜!“*ÑˆBñ Ü˜¨!Ô,¨QÑ/‘ä—V‘V˜B §¡Ó%�Ü˜“H˜Q‘K¢¡4 R 4 Ñ(�à*+ªA¨}°¨}Ð,<Ñ*=ˆBŠq�!�a˜,Ñ&Ð&Ð&Ñ'à�LÑ ˆAÜ˜<Ó(ò &�Ø23²A°q¸1¸q¹5°y°L±/ÀAÂaÈÈ<ÈÐFWÑDXÑ2X�’1�a˜!˜lÑ*¨QÑ.Ð.Ð.Ñ/Ø�\ AÑ%Ñ%‘ð&ô �b“6‰DˆAˆqà’!�\ AÑ%Ñ'Ð'Ñ(ˆAØ—‘�a“ˆAà01ˆAŒb�h‰h”s˜1“v Ñ+Ó,Ñ-Ø�‰FˆAäŸ[™[¨°1©°yÀ±|ÓD‰NˆF�FØˆf�fˆnÓ¤§¡¨¨1¯3©3£Ñ/Õò7	0ð: 
�:Ó	Ø˜Ò%ÜÐPÓQÐQà—O‘OØ˜;¨™?¸Eð $ó 
ˆ	ð ša ¡˜eÑ$ˆ	ô
 �H‰H�a˜ kÐ2Ó3ˆÜ�$˜Ó$ˆÜ—‘˜!˜S˜Ó"ˆð  Ñ$ˆáÜ˜1“Xò D�Ø˜9 Q™<™¨1¨Q©4Ñ/�Ü$'¨¸dÔ$CÑ!��!‘�e˜A‘h¡ðDð �a‰K‰Eä˜1“Xò #�Ø˜9 Q™<™¨1¨Q©4Ñ/�ÜŸ™ ¨¯©Ó1�Ü˜v›,‘��RØ™t ˜t™9��a‘Øš!™T˜r˜T˜'‘{��!’ð#ð �U—Y‘Y˜q“\Ñ!ˆä�f‰f�Q—[‘[  A qÓ)¬2¯7©7°;Ó+?Ó@ˆØŠAˆt�ˆtˆG‹˜ ¢A t G¡Ñ,Ñ,‹ØŠAˆs‰tˆG‹˜šA˜t˜G™Ñ$‹ä—‘˜!˜[Ð)Ó*ˆÜ�q“ò 	,ˆAÜ—v‘v˜a ™d C¨¡FÓ+ˆE�!ŠHð	,à�—‘˜1“ša ˜gÑ&Ñ&ˆð ’A�|‘}Ð$Ñ%×)Ñ)¨!Ó,¨u²Q¸¸¸Ð5EÑ/F×/JÑ/JÈ1Ó/MÑMˆÜ�i‰i˜‹nˆô
 —(‘(˜1¤CÔ(ˆÜ—y‘y ¨Ó*ˆØ ¢ B¡C Ñ(¨<º¸3¸B¸3¸Ñ+?Ñ?À!ÑCˆ	Ü�q“ò 	BˆAÜŸ™¨°1±d¸°d°7Ñ);¸SÓAˆG�AŠJð	Bà�; Ñ$Ñ$ˆñ $ Q¨ F´"·*±*Ô=ˆä�q“ó (	ˆAØ˜!‘*ˆCð �1’a˜ sÑ*Ñ,Ð,Ñ-ˆBÜ—i‘i—n‘n R§V¡V¨A£YÓ/´"·'±'¸#³,Ñ>ˆGô
 —‘˜˜WÓ%¬¯©¨r¯t©t´R·W±W¸[Ó5IÓ(JÑJˆAä—Y‘Y—^‘^ AÓ&ˆFØ˜Ò$Ø�Q‘‘à�V‘�ð �aœ"Ÿ(™(¤2§6¡6¨"¨a£=°!Ó4Ñ4Ñ4¸¸G¹ÀuÈQÒPQÐSWÈZÑGXÑ7XÑXˆBô  Ÿ[™[¨°1©°yÀ±|ÓD‰NˆF�FØˆf�fˆnÓ¤§¡¨¨B¯D©DÓ!1Ñ1ÓØ—f‘f˜Q“iˆGÝ'Ø�1�#�y ‘|Ð#Ó$¨Ñ/Ó$Ø�)˜A‘,  Ð#Ó$¨Ñ/Ô$à�!�Y˜q‘\�/Ó" gÑ-Ó"Ø�)˜A‘, �/Ó" gÑ-Ó"Øˆa�ˆd‹G�s‰N�GòQ(	ðT 
�6Ó	Ø—O‘OØ˜;¨™?¸Eð $ó 
ˆ	ð ša ¡˜eÑ$ˆ	á# Q¨ F´"·*±*Ô=ˆà Ñ$ˆä�q“ó 	HˆAØ�9˜Q‘<‘ˆBØ�"—'‘'˜!“*ÑˆBñ Ü˜¨$Ô/°Ñ2‘ä—V‘V˜B §¡Ó%�Ü˜“H˜Q‘K¢¡4 R 4 Ñ(�ä—‘˜;¨°qÑ(8Ð9Ó:ˆBØš!˜]˜l˜]Ð*Ñ+ˆBŠq�!‘"ˆu‰IØœRŸW™W [Ó1Ñ1ˆBŠq�!ˆt‰Hä—F‘F˜2˜rŸt™tÓ$ˆEäŸ[™[¨°1©°yÀ±|ÓD‰NˆF�FØˆf�fˆnÓ Ñ&Óàˆi˜‰l˜I a™LÐ(Ó)¬R¯W©W¸;Ô-GÑGÕ)ð)	Hñ, Ü  §¡£Ó+ˆäØ	ØØØ!ØØØ!ôð rA   z
array-likeÚleft©Úclosed>   rV   rZ   rY   >   r€   rz   r   rr   rl   ©r0   r5   r’   r3   rj   r\   rk   ru   rv   rw   rl   rD   T©Úprefer_skip_nested_validationc                ó0   — 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Å   Æ  s6   € ô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y)Ú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   >   rV   rZ   rY   >   r€   rz   r   rr   >   rV   ÚbruteÚkd_treeÚ	ball_treerl   )r5   r’   r3   rj   r\   rk   ru   rv   rw   Úneighbors_algorithmrl   rD   Ú_parameter_constraintsé   r{   r   rV   rS   rT   rr   rs   rt   c                ó¬   — || _         || _        || _        || _        || _        || _        || _        || _        |	| _        || _	        |
| _
        || _        y ©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__ù  s_   € ð  'ˆÔØ(ˆÔØˆŒØ(ˆÔØˆŒØ ˆŒØˆŒØ&ˆÔØ(ˆÔØ(ˆÔØ#6ˆÔ Øˆ�rA   c                 óJ  — t        | j                  | j                  | j                  ¬«      | _        t        | j                  «      }t        | |t        ¬«      }| j                  j                  |«       t        | j                  | j                  | j                  | j                  | j                  | j                  | j                  | j                   | j"                  || j$                  | j                  ¬«      \  | _        | _        | j&                  j*                  d   | _        y )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‰jØ×(Ñ(Ø×*Ñ*Ø×*Ñ*Ø—‘Ø—]‘]Ø—;‘;Ø×(Ñ(Ø×*Ñ*Ø%Ø—‘Ø—;‘;ô7
Ñ3ˆŒ˜Ô3ð  $Ÿ™×4Ñ4°QÑ7ˆÕrA   TrÂ   c                 ó(   — | j                  |«       | 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                  |«       | 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                  || j                  d¬«      }t        || j                  j                  || j                  ¬«      }t        j                  |j                  d   | j                  f«      }t        |j                  d   «      D ]8  }t        j                  | j                  ||      j                  ||   «      ||<   Œ: |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‰j×#Ñ#Ø˜4×+Ñ+¸Uð $ó 
ˆô % Q¨¯
©
×(9Ñ(9¸3ÀDÇHÁHÔMˆÜ—‘˜!Ÿ'™' !™* d×&7Ñ&7Ð8Ó9ˆÜ�q—w‘w˜q‘zÓ"ò 	EˆAÜ—v‘v˜dŸo™o¨c°!©fÑ5×7Ñ7¸À¹ÓDˆE�!ŠHð	Eàˆ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ñJ ! ¨1¨d¸6ÔBÐCÙ! (¨A¨t¸FÔCÐDÙ˜˜q $¨vÔ6Ð7Ù#Ò$?Ó@ÐAÙ˜˜q $¨vÔ6Ð7Ù˜h¨¨4¸Ô?Ð@ÙÒIÓJÐKÙ   q¨$°vÔ>Ð?Ù! $¨¨4¸Ô?Ð@Ù *Ò+TÓ UÐVØ'Ð(Ø˜Ð"ñ$Ð˜Dó ð$ ØØØØØØØØØ"ØØôò:8ñ4 °Ô5òó 6ðñ& °Ô5òó 6ðó&rA   rÇ   )r   )r   N)r"   rY   rS   rT   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Ý 1ß QÑ QÝ 6ß Kß QÑ Qó3ól(%ðX QUóIJðb 	ØØØØØØØØôyñx àÐ,Ð-Ù  ¨1¨d¸6ÔBÐCÙ! (¨A¨t¸FÔCÐDÙ˜˜q $¨vÔ6Ð7Ù#Ò$?Ó@ÐAÙ˜˜q $¨vÔ6Ð7Ù˜h¨¨4¸Ô?Ð@ÙÒIÓJÐKÙ   q¨$°vÔ>Ð?Ù! $¨¨4¸Ô?Ð@Ø'Ð(Ø˜Ð"ñð #'ôð, 	ØØØØØØØØóFó#ð"FôRUØ#ØØØõ	UrA   