Class LTSA<T>
- Namespace
- AiDotNet.Preprocessing.DimensionalityReduction
- Assembly
- AiDotNet.dll
Local Tangent Space Alignment for nonlinear dimensionality reduction.
public class LTSA<T> : TransformerBase<T, Matrix<T>, Matrix<T>>, IDataTransformer<T, Matrix<T>, Matrix<T>>
Type Parameters
TThe numeric type for calculations (e.g., float, double).
- Inheritance
-
LTSA<T>
- Implements
- Inherited Members
Remarks
LTSA is a manifold learning algorithm that uses local tangent spaces to compute a global embedding. It estimates the tangent space at each point using PCA on neighbors, then aligns these local coordinate systems.
The algorithm: 1. Find k-nearest neighbors for each point 2. Compute local tangent space via PCA on each neighborhood 3. Compute local coordinates in tangent space 4. Align tangent spaces by minimizing reconstruction error
For Beginners: LTSA is an improved version of LLE that: - Uses tangent spaces (local linear approximations) at each point - Better handles points with different local geometries - More mathematically principled than standard LLE
Use cases:
- When standard LLE produces poor results
- Manifolds with varying curvature
- When you need more stable embeddings
Constructors
LTSA(int, int, int?, int[]?)
Creates a new instance of LTSA<T>.
public LTSA(int nComponents = 2, int nNeighbors = 5, int? randomState = null, int[]? columnIndices = null)
Parameters
nComponentsintTarget dimensionality. Defaults to 2.
nNeighborsintNumber of neighbors. Defaults to 5.
randomStateint?Random seed for reproducibility.
columnIndicesint[]The column indices to use, or null for all columns.
Properties
Embedding
Gets the embedding result.
public double[,]? Embedding { get; }
Property Value
- double[,]
NComponents
Gets the number of components (dimensions).
public int NComponents { get; }
Property Value
NNeighbors
Gets the number of neighbors.
public int NNeighbors { get; }
Property Value
SupportsInverseTransform
Gets whether this transformer supports inverse transformation.
public override bool SupportsInverseTransform { get; }
Property Value
Methods
FitCore(Matrix<T>)
Fits LTSA and computes the embedding.
protected override void FitCore(Matrix<T> data)
Parameters
dataMatrix<T>
GetFeatureNamesOut(string[]?)
Gets the output feature names after transformation.
public override string[] GetFeatureNamesOut(string[]? inputFeatureNames = null)
Parameters
inputFeatureNamesstring[]
Returns
- string[]
InverseTransformCore(Matrix<T>)
Inverse transformation is not supported.
protected override Matrix<T> InverseTransformCore(Matrix<T> data)
Parameters
dataMatrix<T>
Returns
- Matrix<T>
TransformCore(Matrix<T>)
Returns the embedding computed during Fit.
protected override Matrix<T> TransformCore(Matrix<T> data)
Parameters
dataMatrix<T>
Returns
- Matrix<T>