UMAP<T>
Models & Types · AiDotNet.Preprocessing.DimensionalityReduction
Uniform Manifold Approximation and Projection for dimensionality reduction.
Inheritance: TransformerBase<T, Matrix<T>, Matrix<T>> → UMAP<T>
For Beginners
UMAP creates visualizations similar to t-SNE but:
- It’s faster, especially for large datasets
- Distances between clusters are more meaningful
- You can transform new data points without refitting
- Great for both visualization AND as a preprocessing step for ML
Example use cases:
- Visualizing high-dimensional data (gene expression, embeddings)
- Preprocessing features for classification
- Clustering analysis
- Anomaly detection
How It Works
UMAP is a nonlinear dimensionality reduction technique that constructs a high-dimensional graph representation and optimizes a low-dimensional graph to be as structurally similar as possible. It is based on Riemannian geometry and algebraic topology.
Key advantages over t-SNE:
- Much faster (scales better to large datasets)
- Preserves more global structure
- Supports out-of-sample transformation
- More deterministic results
Constructors
| Constructor | Summary |
|---|---|
UMAP(int nComponents, int nNeighbors, double minDist, double spread, UMAPMetric metric, int nEpochs, double learningRate, double negativeSampleRate, double localConnectivity, double repulsionStrength, int? randomState, int[] columnIndices) |
Creates a new instance of UMAP. |
Properties
| Property | Summary |
|---|---|
UMAPMetric Metric { get; } |
Gets the distance metric. |
bool SupportsInverseTransform { get; } |
Gets whether this transformer supports inverse transformation. |
double MinDist { get; } |
Gets the minimum distance parameter. |
double[] Embedding { get; } |
Gets the embedding result. |
int NComponents { get; } |
Gets the number of components (dimensions). |
int NNeighbors { get; } |
Gets the number of neighbors. |
Methods
| Method | Summary |
|---|---|
Matrix<T> GetEmbedding() |
Gets the embedding computed during Fit for the training data. |
string[] GetFeatureNamesOut(string[] inputFeatureNames) |
Gets the output feature names after transformation. |