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
TThe numeric type for calculations (e.g., float, double).
- Inheritance
-
LargeVis<T>
- Implements
- 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
nComponentsintTarget dimensionality. Defaults to 2.
nNeighborsintNumber of neighbors for graph construction. Defaults to 150.
nNegativesintNumber of negative samples per positive sample. Defaults to 5.
nIterintNumber of optimization iterations. Defaults to 200.
learningRatedoubleInitial learning rate. Defaults to 1.0.
gammadoubleRepulsion strength for negative samples. Defaults to 7.0.
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 LargeVis 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>