LocallyLinearEmbedding
- class sklearn.manifold.LocallyLinearEmbedding(*, n_neighbors=5, n_components=2, reg=0.001, eigen_solver='auto', tol=1e-06, max_iter, , , , , ,
Locally Linear Embedding.
Read more in the User Guide.
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.
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.
Tolerance for ‘arpack’ method Not used if eigen_solver==’dense’.
Maximum number of iterations for the arpack solver. Not used if eigen_solver==’dense’.
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]
Tolerance for Hessian eigenmapping method.
Only used if method == 'hessian'.
Tolerance for modified LLE method.
Only used if method == 'modified'.
Algorithm to use for nearest neighbors search, passed to
NearestNeighbors instance.
Determines the random number generator when
eigen_solver == ‘arpack’. Pass an int for reproducible results
across multiple function calls. See Glossary.
The number of parallel jobs to run.
None means 1 unless in a joblib.parallel_backend context.
-1 means using all processors. See Glossary
for more details.
Stores the embedding vectors
Reconstruction error associated with embedding_
Number of features seen during fit.
n_features_in_,)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 LocallyLinearEmbedding
>>> X, _ = load_digits(return_X_y=True)
>>> X.shape
(1797, 64)
>>> embedding = LocallyLinearEmbedding(n_components=
Compute the embedding vectors for data X.
Training set.
Not used, present here for API consistency by convention.
Compute the embedding vectors for data X and transform X.
Training set.
Not used, present here for API consistency by convention.
Get output feature names for transformation.
The feature names out will prefixed by the lowercased class name. For
example, if the transformer outputs 3 features, then the feature names
out are: ["class_name0", "class_name1", "class_name2"].
Only used to validate feature names with the names seen in fit.
Get metadata routing of this object.
Please check User Guide on how the routing mechanism works.
A MetadataRequest encapsulating
routing information.
Get parameters for this estimator.
If True, will return the parameters for this estimator and contained subobjects that are estimators.
Parameter names mapped to their values.
Set output container.
Refer to the user guide for more details and Introducing the set_output API for an example on how to use the API.
Configure output of transform and .
Set the parameters of this estimator.
The method works on simple estimators as well as on nested objects
(such as Pipeline). The latter have
parameters of the form <component>__<parameter> so that it’s
possible to update each component of a nested object.
Estimator parameters.
Transform new points into embedding space.
Training set.
Returns the instance itself.
Because of scaling performed by this method, it is discouraged to use it together with methods that are not scale-invariant (like SVMs).
Manifold learning on handwritten digits: Locally Linear Embedding, Isomap…
Names of features seen during fit. Defined only when X
has feature names that are all strings.
Stores nearest neighbors instance, including BallTree or KDtree if applicable.
Fitted LocallyLinearEmbedding class instance.
Returns the instance itself.
Transformed feature names.
"default": Default output format of a transformer
"pandas": DataFrame output
"polars": Polars output
None: Transform configuration is unchanged
Estimator instance.
Estimator instance.