Class Isomap<T>
- Namespace
- AiDotNet.Preprocessing.DimensionalityReduction
- Assembly
- AiDotNet.dll
Isomap (Isometric Mapping) for nonlinear dimensionality reduction.
public class Isomap<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
-
Isomap<T>
- Implements
- Inherited Members
Remarks
Isomap extends classical MDS by estimating geodesic distances along the data manifold instead of using Euclidean distances. It builds a neighborhood graph and computes shortest paths to estimate geodesic distances.
The algorithm: 1. Build a k-nearest neighbors graph 2. Compute shortest path distances (Floyd-Warshall or Dijkstra) 3. Apply MDS to the geodesic distance matrix
For Beginners: Isomap "unrolls" curved data: - Imagine data lying on a Swiss roll (curved surface) - Regular PCA can't flatten it properly - Isomap finds distances along the surface, not through the air - Result: Points that are nearby on the surface stay nearby
Constructors
Isomap(int, int, IsomapNeighborAlgorithm, IsomapPathAlgorithm, int[]?)
Creates a new instance of Isomap<T>.
public Isomap(int nComponents = 2, int nNeighbors = 5, IsomapNeighborAlgorithm neighborAlgorithm = IsomapNeighborAlgorithm.Auto, IsomapPathAlgorithm pathAlgorithm = IsomapPathAlgorithm.Dijkstra, int[]? columnIndices = null)
Parameters
nComponentsintTarget dimensionality. Defaults to 2.
nNeighborsintNumber of neighbors for graph construction. Defaults to 5.
neighborAlgorithmIsomapNeighborAlgorithmAlgorithm for neighbor search. Defaults to Auto.
pathAlgorithmIsomapPathAlgorithmAlgorithm for shortest paths. Defaults to Dijkstra.
columnIndicesint[]The column indices to use, or null for all columns.
Properties
Embedding
Gets the embedding result.
public double[,]? Embedding { get; }
Property Value
- double[,]
GeodesicDistances
Gets the geodesic distance matrix.
public double[,]? GeodesicDistances { get; }
Property Value
- double[,]
NComponents
Gets the number of components.
public int NComponents { get; }
Property Value
NNeighbors
Gets the number of neighbors for graph construction.
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 Isomap by computing geodesic distances and 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>