LocallyLinearEmbedding
#include <Skigen/Manifold>
template <typename Scalar = double>
class Skigen::LocallyLinearEmbedding(n_components=2, n_neighbors=5, reg=1e-3, max_iter=100, tol=1e-6, method="standard", eigen_solver="auto")
Locally Linear Embedding (LLE).
Nonlinear dimensionality reduction that preserves local neighborhood structure. Each point is reconstructed as a weighted linear combination of its K nearest neighbors; the embedding is then found by minimising the same reconstruction error in the low-dimensional space.
Mirrors sklearn.manifold.LocallyLinearEmbedding.
Parameters:
-
n_components : int, default=2 Number of embedding dimensions (default
2). -
n_neighbors : int, default=5 Number of nearest neighbors (default
5). -
reg : Scalar, default=1e-3 Regularisation added to the local covariance matrix (default
1e-3). -
max_iter : int, default=100 Reserved for iterative eigen solvers (default
100). -
tol : Scalar, default=1e-6 Convergence tolerance (default
1e-6). -
method : std::string, default="standard" LLE variant,
"standard"(default) or"modified". -
eigen_solver : std::string, default="auto" Eigensolver backend:
"auto","arpack", or"dense"(default"auto")."arpack"is only active underSKIGEN_ENABLE_SPECTRA; otherwise the dense solver is used.
Attributes:
-
eigen_solver : const std::string The configured eigensolver name (
"auto"/"arpack"/"dense"). -
method : const std::string LLE variant string (
"standard"or"modified"). -
embedding : MatrixType Embedding vectors of shape (n_samples, n_components).
-
reconstruction_error : Scalar Sum of squared reconstruction residuals.
Methods
SKIGEN_PARAMS()
Fit the LLE model: compute an embedding of X.
Parameters:
- X Input data of shape (n_samples, n_features).
Returns:
- result
Reference to the fitted transformer (
*this).
transform(X)
Return the stored embedding (same as fit result).
Because standard LLE has no out-of-sample extension, transform returns the embedding computed during fit. X is expected to be the same data that was used for fitting.
Parameters:
- X : MatrixType Data matrix (must match the training data shape).
Returns:
- result : MatrixType The embedding of shape (n_samples, n_components).