
    -iMw                        S r SSKJrJr  SSKrSSKJrJrJ	r	J
r
  SSKJrJrJr  SSKJr  SSKJrJrJrJrJr  SS	KJr  SS
KJrJr  SSKJr  SSKJrJ r J!r!  SSK"J#r#  SSK$J%r%J&r&J'r'  S(S jr(S)S jr) S*S jr*SSSSSSSSSS.	S jr+\!" S\/\" \SSSS9/\" \SSSS9/\" \SSSS9/\ " 1 Sk5      /\" \SSSS9/\" \SSSS9/\ " 1 S k5      /\" \SSSS9/\" \SSSS9/S!/S\/S".S#S$9SSSSSSSSSS.	S% j5       r, " S& S'\\\\5      r-g)+zLocally Linear Embedding    )IntegralRealN)eighqrsolvesvd)
csr_matrixeye
lil_matrix)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validate_dataMbP?c                 l   [        U [        S9n [        U[        S9n[        U[        S9nUR                  u  pEU R                  S   U:X  d   e[        R
                  " XE4U R                  S9n[        R                  " XPR                  S9n[        U5       H  u  pX   n
XU   -
  n[        R                  " XR                  5      n[        R                  " U5      nUS:  a  X=-  nOUnUR                  SSUS-   2==   U-  ss'   [        XSS9nU[        R                  " U5      -  XhSS24'   M     U$ )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                   S/var/www/html/venv/lib/python3.13/site-packages/sklearn/manifold/_locally_linear.pybarycenter_weightsr@      s   6 	A\*AA\*A'-G$]]I771:"""
))9A
77+A G$F!HFF1ccN19AA	!+/!"a'"!'bffQi-Q$ % H    c                 >   [        US-   US9R                  U 5      nUR                  n UR                  nUR	                  U SS9SS2SS24   n[        X XbS9n[        R                  " SXQ-  S-   U5      n[        UR                  5       UR                  5       U4XU4S9$ )	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	   ravel)	r0   r5   r3   rD   knnr4   r9   dataindptrs	            r?   barycenter_kneighbors_graphrQ   R   s    B {Qv
F
J
J1
MC

A""I
..E.
21ab5
9CaC1DYYq)1A5{CFtzz|SYY[&9)AWXXrA   r"   ư>d   c           	      Z   US:X  a   U R                   S   S:  a  X-   S:  a  SnOSnUS:X  aN  [        U R                   S   U5      n [        XU-   SXEUS9u  pU	S
S
2US
24   [
        R                  " XS
 5      4$ US:X  a}  [        U S5      (       a  U R                  5       n [        XX-   S-
  4SS9u  p[
        R                  " [
        R                  " U5      5      nU	S
S
2U4   [
        R                  " U5      4$ [	        SU-  5      e! [         a  n
[	        S	U
-  5      U
eS
n
A
ff = f)a  
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_spacerp   |   sG   T v771:
R#L"LxQWWQZ6	*/v:Sc+'L QZ("&&g1F*GGG		 1i  		A&*
Q7T'
# 

266,/0QX&|(<<<9LHII'  	6 9:	: 	s   D 
D*D%%D*rU   standard-C6?-q=)	r3   ri   r[   rj   methodhessian_tolmodified_tolrk   rD   c          
      
   [        US-   US9nUR                  U 5        UR                  n U R                  u  pX.:  a  [	        S5      eX:  a  [	        SX4-  5      eUS:g  nU(       a  [
        O[        R                  nUS:X  a  [        XX;S9nU(       a3  [        UR                  SUR                  06U-
  nUR                  U-  nGOUR                  U-  UR                  -
  U-
  R                  5       nUR                  S S UR                  S	   S-   2==   S-  ss'   GO=US
:X  Ga  X"S-   -  S-  nXU-   ::  a  [	        S5      eUR                  XS-   SS9nUS S 2SS 24   n[        R                  " USU-   U-   4[        R                   S9nSUS S 2S	4'   U" X4[        R                   S9nX:  n[#        U5       GHr  nU UU      nUUR%                  S	5      -  nU(       a  ['        US	S9S	   nO9[        R(                  " UUR                  5      n[+        U5      S   S S 2S S S24   nUS S 2S U24   US S 2SSU-   24'   SU-   n[#        U5       H4  nUS S 2UUS-   24   US S 2UU24   -  US S 2UUU-   U-
  24'   UUU-
  -  nM6     [-        U5      u  nnUS S 2US-   S 24   nUR/                  S	5      n SU [        R0                  " [3        U 5      U:  5      '   UU -  n[        R4                  " UU   UU   5      u  n!n"UU!U"4==   [        R(                  " UUR                  5      -  ss'   GMu     GO)US:X  Ga  X:  a  [	        S5      eUR                  XS-   SS9nUS S 2SS 24   n[        R                  " XU45      n#[7        X5      n$[        R                  " UU$/5      n%X:  nU(       a:  [#        U5       H%  nU UU      U U   -
  n&['        U&SS9u  U#U'   U%U'   n'M'     U%S-  n%Oi[#        U5       HZ  nU UU      U U   -
  n&[        R(                  " U&U&R                  5      n([+        U(5      u  n)n*U)S S S2   U%U'   U*S S 2S S S24   U#U'   M\     SU%R/                  S5      -  n[        R(                  " U#R9                  S	SS5      [        R:                  " U5      5      n+U+S S 2S U$24==   U%US S 2S 4   -   -  ss'   U+S S 2U$S 24==   US S 2S 4   -  ss'   [        R                  " X45      n,[#        U5       H#  n[        R(                  " U#U   U+U   5      U,U'   M%     U,U,R/                  S5      S S 2S 4   -  n,U%S S 2US 24   R/                  S5      U%S S 2S U24   R/                  S5      -  n-[        R<                  " U-5      n.[        R                  " U[>        S9n/[A        U%S5      n0U0S S 2SS 24   U0S S 2S S24   -  S-
  n1[#        U5       H%  n[        RB                  " U1US S S24   U.5      U/U'   M'     U/UU$-
  -  n/U" X4[        R                   S9n[#        U5       GH  nU/U   n2U#US S 2UU2-
  S 24   n3[        RD                  RG                  U3R/                  S	5      5      [        RH                  " U25      -  n4[        RJ                  " U2U45      [        R(                  " U3R                  [        R:                  " U5      5      -
  n5[        RD                  RG                  U55      n6U6U	:  a  U5S	-  n5OU5U6-  n5U3S[        RL                  " [        R(                  " U3U55      U55      -  -
  SU4-
  U,US S 2S 4   -  -   n7[        R4                  " UU   UU   5      u  n!n"UU!U"4==   [        R(                  " U7U7R                  5      -  ss'   U7R/                  S5      n8UUUU   4==   U8-  ss'   UUU   U/4==   U8-  ss'   UUU4==   U2-  ss'   GM     GOUS:X  Ga{  UR                  XS-   SS9nUS S 2SS 24   nU" X4[        R                   S9nX:  n[#        U5       GH3  nU UU      n9U9U9R%                  S	5      -  n9U(       a  ['        U9SS9S	   n:O9[        R(                  " U9U9R                  5      n[+        U5      S   S S 2S S S24   n:[        R                  " XS-   45      nU:S S 2S U24   US S 2SS 24'   S[        RH                  " U5      -  US S 2S	4'   [        R(                  " UUR                  5      n;[        R4                  " UU   UU   5      u  n!n"UU!U"4==   U;-  ss'   UUU   UU   4==   [        R:                  " US9-  ss'   GM6     U(       a  WRO                  5       n[Q        WUSUUUU
S9$ )Nr"   rC   z>output dimension must be less than or equal to input dimensionzFExpected n_neighbors < n_samples, but n_samples = %d, n_neighbors = %drY   rq   )r5   r3   rD   formatr   hessianr   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   )rh   ri   r[   rj   rk   ))r   rH   rI   r&   rb   r   r'   zerosrQ   r
   rx   r,   r^   r.   rK   r(   float64rangemeanr   r+   r   r   r/   wherere   meshgridmin	transposer)   medianr%   r   searchsortedlinalgnormsqrtfulloutertocsrrp   )<r0   r5   n_componentsr3   ri   r[   rj   rt   ru   rv   rk   rD   nbrsNd_inM_sparseM_container_constructorWrf   dp	neighborsYiuse_svdr8   GiUCijrg   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GDHHQKAggGAL
 	
 T
 	

 w&H,4j"(('s
 QWW.QXX.2AaAq133"++-AFF$aggaj1n$%*%	9	A-.!3++:  OO?E $ 
	 ae$	XX{A$4r$9:"**M1a4#QF"**=$qA9Q<B"''!*B !,Q/VVB%HQK4R4(*+A}},<*=Bq!a,&&&'L A<(23Aq1q5yL/Aa<FWDX2X1a!l*Q.../\A%% ) b6DAq!\A%''(AaA01Abhhs1v+,-FA[[1y|DNFFffn133/7 : 
:	%PQQOO?E $ 
	 ae$	
 HHak23$$!S" $1X9Q<1Q4/$'d$C!!eAh  aKE1X9Q<1Q4/1v,Rtt9a!TrT'{!  UYYq\!ffQ[[Aq)277;+?@AttGAtG,,AstGAtG$!)*qAvvadCF+E!H 1ag&& A|}$%))!,uQ5E/F/J/J1/MMiin
 ((1C($UA. BC(<3B3+??!C	qA1dd7);SAGAJ ;$$ $QF"**=qA!*C 1as*,,-BiinnRVVAY/"''#,>G
 W%rttRWW[5I(JJAYY^^A&F$QV a"((266"a=!444GuQPQSWZGX7XXB  [[1y|DNFFffnBDD!11ffQiGa1o')ilQC G+ adGsNGI L 
6	OO?E $ 
	 ae$	#QF"**=$qA9Q<B"''!*B $/2VVB%HQK4R4(;q(89:B!]l]*+Bq!"uIRWW[11Bq!tHFF2rtt$E[[1y|DNFFffn&ilIaL()RWW;-GG)) , GGI	!! rA   z
array-likeleftclosed>   rU   rY   rX   >   r~   ry   r}   rq   rk   r0   r5   r   r3   ri   r[   rj   rt   ru   rv   rk   rD   Tprefer_skip_nested_validationc                *    [        U UUUUUUUUU	U
US9$ )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                   V   \ rS rSr% Sr\" \SSSS9/\" \SSSS9/\" \SSSS9/\" 1 Sk5      /\" \SSSS9/\" \SSSS9/\" 1 S	k5      /\" \SSSS9/\" \SSSS9/\" 1 S
k5      /S/S\/S.r	\
\S'   SSSSSSSSSSSSS.S jrS r\" SS9SS j5       r\" SS9SS j5       rS rSrg) LocallyLinearEmbeddingiZ  a  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   >   rU   rY   rX   >   r~   ry   r}   rq   >   rU   brutekd_tree	ball_treerk   )r5   r   r3   ri   r[   rj   rt   ru   rv   neighbors_algorithmrk   rD   _parameter_constraints   r   r   rU   rR   rS   rq   rr   rs   c                    Xl         X l        X0l        X@l        XPl        X`l        Xpl        Xl        Xl        Xl	        Xl
        Xl        g N)r5   r   r3   ri   r[   rj   rt   ru   rv   rk   r   rD   )selfr5   r   r3   ri   r[   rj   rt   ru   rv   r   rk   rD   s                r?   __init__LocallyLinearEmbedding.__init__  sG      '(( &((#6 rA   c                 6   [        U R                  U R                  U R                  S9U l        [        U R                  5      n[        X[        S9nU R                  R                  U5        [        U R                  U R                  U R                  U R                  U R                  U R                  U R                  U R                   U R"                  UU R$                  U R                  S9u  U l        U l        U R&                  R*                  S   U l        g )N)r5   	algorithmrD   r    )r0   r5   r   ri   r[   rj   rt   ru   rv   rk   r3   rD   r"   )r   r5   r   rD   nbrs_r   rk   r   floatrH   r   r   ri   r[   rj   rt   ru   rv   r3   
embedding_reconstruction_error_r&   _n_features_out)r   r0   rk   s      r?   _fit_transform%LocallyLinearEmbedding._fit_transform  s    %((..;;

 *$*;*;<$/

q6Ojj((****]];;((**%;;7
33  $44Q7rA   Tr   c                 (    U R                  U5        U $ )a!  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   LocallyLinearEmbedding.fit*  s    " 	ArA   c                 <    U R                  U5        U R                  $ )aD  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_transform$LocallyLinearEmbedding.fit_transform>  s    " 	ArA   c                    [        U 5        [        XSS9nU R                  R                  XR                  SS9n[        XR                  R                  X R                  S9n[        R                  " UR                  S   U R                  45      n[        UR                  S   5       H7  n[        R                  " U R                  X%      R                  X5   5      XE'   M9     U$ )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)resetrz   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?   	transform LocallyLinearEmbedding.transformR  s    & 	$/jj##++U $ 
 %Q

(9(93HHM!''!*d&7&789qwwqz"Avvdoocf577DEH #rA   )r   ri   r   ru   rj   rt   rv   r   rD   r5   r   r   rk   r   r3   r[   r   )__name__
__module____qualname____firstlineno____doc__r   r   r   r   r   dict__annotations__r   r   r   rH   r   r   __static_attributes__ rA   r?   r   r   Z  s*   BJ !1d6BC!(AtFCDq$v67#$?@Aq$v67h4?@IJK q$v>?!$4?@ *+T UV'("$D $ ":84 5 6& 5 6&rA   r   )r   )r   N)r"   rX   rR   rS   N).r   numbersr   r   numpyr'   scipy.linalgr   r   r   r   scipy.sparser	   r
   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   r@   rQ   rp   r   r   r   r   rA   r?   <module>r      s   
 #  - - 4 4 %  ) 3 + K K ) K K3l'YV QUIJb 	up ,- 1d6BC!(AtF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   