Table of Contents

Class LaplacianEigenmaps<T>

Namespace
AiDotNet.Preprocessing.DimensionalityReduction
Assembly
AiDotNet.dll

Laplacian Eigenmaps for nonlinear dimensionality reduction.

public class LaplacianEigenmaps<T> : TransformerBase<T, Matrix<T>, Matrix<T>>, IDataTransformer<T, Matrix<T>, Matrix<T>>

Type Parameters

T

The numeric type for calculations (e.g., float, double).

Inheritance
TransformerBase<T, Matrix<T>, Matrix<T>>
LaplacianEigenmaps<T>
Implements
IDataTransformer<T, Matrix<T>, Matrix<T>>
Inherited Members

Remarks

Laplacian Eigenmaps constructs a weighted graph from the data and finds a low-dimensional embedding that preserves local neighborhood relationships by minimizing a cost function based on the graph Laplacian.

The algorithm: 1. Constructs a k-nearest neighbor or epsilon-neighborhood graph 2. Computes edge weights using a kernel (e.g., heat kernel) 3. Computes the graph Laplacian: L = D - W 4. Finds eigenvectors of the generalized eigenvalue problem: L*y = λ*D*y

For Beginners: Laplacian Eigenmaps finds a low-dimensional representation where: - Connected points in the graph stay close together - The embedding respects the local geometry of the data - It's similar to spectral clustering but for dimensionality reduction

Use cases:

  • Manifold learning when data lies on a curved surface
  • Image segmentation and clustering
  • When you want to preserve local connectivity

Constructors

LaplacianEigenmaps(int, int, double?, LaplacianAffinityType, double, int?, int[]?)

Creates a new instance of LaplacianEigenmaps<T>.

public LaplacianEigenmaps(int nComponents = 2, int nNeighbors = 5, double? radius = null, LaplacianAffinityType affinity = LaplacianAffinityType.NearestNeighbors, double gamma = 1, int? randomState = null, int[]? columnIndices = null)

Parameters

nComponents int

Target dimensionality. Defaults to 2.

nNeighbors int

Number of neighbors for graph construction. Defaults to 5.

radius double?

Radius for epsilon-neighborhood (if null, uses k-NN). Defaults to null.

affinity LaplacianAffinityType

Affinity type for edge weights. Defaults to NearestNeighbors.

gamma double

Kernel coefficient for RBF affinity. Defaults to 1.0.

randomState int?

Random seed for reproducibility.

columnIndices int[]

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

int

NNeighbors

Gets the number of neighbors.

public int NNeighbors { get; }

Property Value

int

SupportsInverseTransform

Gets whether this transformer supports inverse transformation.

public override bool SupportsInverseTransform { get; }

Property Value

bool

Methods

FitCore(Matrix<T>)

Fits Laplacian Eigenmaps and computes the embedding.

protected override void FitCore(Matrix<T> data)

Parameters

data Matrix<T>

GetFeatureNamesOut(string[]?)

Gets the output feature names after transformation.

public override string[] GetFeatureNamesOut(string[]? inputFeatureNames = null)

Parameters

inputFeatureNames string[]

Returns

string[]

InverseTransformCore(Matrix<T>)

Inverse transformation is not supported.

protected override Matrix<T> InverseTransformCore(Matrix<T> data)

Parameters

data Matrix<T>

Returns

Matrix<T>

TransformCore(Matrix<T>)

Returns the embedding computed during Fit.

protected override Matrix<T> TransformCore(Matrix<T> data)

Parameters

data Matrix<T>

Returns

Matrix<T>