Perform a Locally Linear Embedding analysis on the data.
Read more in the User Guide.
Sample data, shape = (n_samples, n_features), in the form of a numpy array or a NearestNeighbors object.
Number of neighbors to consider for each point.
Number of coordinates for the manifold.
Regularization constant, multiplies the trace of the local covariance matrix of the distances.
auto : algorithm will attempt to choose the best method for input data
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.
decomposition. For this method, M must be an array or matrix type. This method should be avoided for large problems.
Tolerance for ‘arpack’ method Not used if eigen_solver==’dense’.
Maximum number of iterations for the arpack solver.
see reference [1]
n_neighbors > n_components * (1 + (n_components + 1) / 2. see reference [2]
see reference [3]
see reference [4]
Tolerance for Hessian eigenmapping method. Only used if method == ‘hessian’.
Tolerance for modified LLE method. Only used if method == ‘modified’.
Determines the random number generator when solver == ‘arpack’. Pass an int for reproducible results across multiple function calls. See Glossary.
The number of parallel jobs to run for neighbors search. None means 1 unless in a joblib.parallel_backend context. -1 means using all processors. See Glossary for more details.
Embedding vectors.
Reconstruction error for the embedding vectors. Equivalent to norm(Y - W Y, 'fro')**2, where W are the reconstruction weights.
Roweis, S. & Saul, L. Nonlinear dimensionality reduction by locally linear embedding. Science 290:2323 (2000).
Donoho, D. & Grimes, C. Hessian eigenmaps: Locally linear embedding techniques for high-dimensional data. Proc Natl Acad Sci U S A. 100:5591 (2003).
Zhang, Z. & Zha, H. Principal manifolds and nonlinear dimensionality reduction via tangent space alignment. Journal of Shanghai Univ. 8:406 (2004)
>>> 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)
© 2007–2025 The scikit-learn developers
Licensed under the 3-clause BSD License.
https://scikit-learn.org/1.6/modules/generated/sklearn.manifold.locally_linear_embedding.html