Table of Contents

Class LargeVis<T>

Namespace
AiDotNet.Preprocessing.DimensionalityReduction
Assembly
AiDotNet.dll

LargeVis for large-scale visualization and dimensionality reduction.

public class LargeVis<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>>
LargeVis<T>
Implements
IDataTransformer<T, Matrix<T>, Matrix<T>>
Inherited Members

Remarks

LargeVis is designed for visualizing large-scale high-dimensional data. It builds a k-NN graph, computes edge weights based on shared neighbors, and uses asynchronous stochastic gradient descent with negative sampling for optimization.

The algorithm: 1. Construct approximate k-NN graph using random projection trees 2. Compute edge weights using shared neighbor similarity 3. Initialize embedding with random projection or PCA 4. Optimize using negative sampling SGD (similar to word2vec)

For Beginners: LargeVis is efficient for large datasets because: - Uses approximate nearest neighbors for scalability - Negative sampling reduces computation vs full graph - Asynchronous updates enable parallel processing - Layout preserves local neighborhood relationships

Use cases:

  • Datasets with millions of points
  • When t-SNE is too slow
  • Interactive visualization systems
  • Document and image embedding visualization

Constructors

LargeVis(int, int, int, int, double, double, int?, int[]?)

Creates a new instance of LargeVis<T>.

public LargeVis(int nComponents = 2, int nNeighbors = 150, int nNegatives = 5, int nIter = 200, double learningRate = 1, double gamma = 7, int? randomState = null, int[]? columnIndices = null)

Parameters

nComponents int

Target dimensionality. Defaults to 2.

nNeighbors int

Number of neighbors for graph construction. Defaults to 150.

nNegatives int

Number of negative samples per positive sample. Defaults to 5.

nIter int

Number of optimization iterations. Defaults to 200.

learningRate double

Initial learning rate. Defaults to 1.0.

gamma double

Repulsion strength for negative samples. Defaults to 7.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 LargeVis 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>