Installation
UMAP-Sharp ships as the UMAP NuGet package. It is a pure managed library with no native dependencies and multi-targets netstandard2.0, netstandard2.1, net7.0, net8.0, net9.0, and net10.0, so it runs on Windows, Linux, macOS, and ARM.
View on NuGet View source on GitHub
Install the package
dotnet add package UMAP
Supported target frameworks
| TFM | Status |
|---|---|
netstandard2.0 |
Supported |
netstandard2.1 |
Supported |
net7.0 |
Supported |
net8.0 |
Supported |
net9.0 |
Supported |
net10.0 |
Supported |
The library only depends on System.Memory for Span<T> support on the older targets. There are no native binaries.
Verify the install
Create a tiny console project and run the snippet below — it generates a 100-point random embedding to confirm the library is wired up correctly.
using UMAP;
var rng = new Random(42);
var vectors = Enumerable.Range(0, 100)
.Select(_ => Enumerable.Range(0, 50)
.Select(_ => (float)rng.NextDouble())
.ToArray())
.ToArray();
var umap = new Umap();
var epochs = umap.InitializeFit(vectors);
for (var i = 0; i < epochs; i++)
{
umap.Step();
}
var embedding = umap.GetEmbedding();
Console.WriteLine($"Got {embedding.Length} embeddings of dimension {embedding[0].Length}");
You should see:
Got 100 embeddings of dimension 2