annembed
Library Listed
a Rust implementation of a dimension reduction à la Umap
- Downloads
- 799
- Dependents
- 4
- Stars
- 45
- Forks
- 8
- Contributors
- 4
- Commits
- 393
- Latest release
- 0.1.6 ·
About
A data embedding tool and related data analysis or clustering

The crate provides mainly in the form of a library (See documentation of the binary embed for a small executable embedding data in csv files):
Some variations on data embedding tools from t-Sne (2008) to Umap(2018).
Our implementation is a mix of the various embedding algorithms mentioned in References.
Read the full README
The graph is initialized by the Hnsw nearest neighbour algorithm as implemented in: hnsw_rs.
This provides for free, sub-sampling in the data to embed by considering only less densely occupied layers (the upper layers). This corresponds generally to a subsampling of 2%-4%, but can give a guarantee as the distance beetween points leaved out the sampling and its nearest sampled neighbour are known. The hnsw structure thus enables also an iterative/hierarchical initialization of the embedding by taking into account an increasing number of layers.The preliminary graph built for the embedding uses an exponential function of distances to neighbour nodes (as in Umap),but keeps a probability normalization constraint with respect to neighbours (as in T-sne). It is possible to modulate the initial edge weight by :
- Considering a power of the distance function to neighbours (See documentation in module EmbedderParams).
- Increase or decrease the impact of the local density of points around each node. There is no symetrization of the graph. (except when initializing the embedding with diffusion maps in this case it is done as in t-sne or LargeVis). We use the diffusion maps algorithm (Lafon-Keller-Coifman).We also use a cross entropy optimization of this initial layout but take into account the initial local density estimate of each point when computing the cauchy weight of an embedded edge. The corresponding "perplexity" distribution is estimated on the fly. (See documentation in module EmbedderParams).
A tentative estimation of embedding faithfulness.
We quantify the stability of neighbourhoods through the embedding as this helps selecting among varying results between runs for a given data set. The default dimension of 2 is used for visualization purposes, but for other purposes, increasing the dimension shows a better conservation of neighborhoods. It is known that the dimension of the target space is critical in the embedding process. (See Whitney embedding theorem).
This can be verified in examples (especially the Higgs data) and detailed in the documentation of function Embedder::get_quality_estimate_from_edge_length and is illustrated in examples directory.
Some by-products :
an implementation of range approximation and approximated SVD for dense and/or row compressed matrices as described in the svdapprox module and the paper of Halko-Tropp (Cf. Tsvd).
2 different algorithms to estimate the intrinsic dimension of data, as described in:
An estimation of the hubness of the graph of the Hnsw structure as described in: Radovanovic M., Nanopoulos A. and Ivanovic M. 2010. See paper.
a Diffusion Maps implementation, with fixed and variable bandwith. (See the bibliography in module Diffmaps)
A link to the Topological Data Analysis Julia package Ripserer.jl (See the directory Julia in the crate).
The distance matrix between points in a neighbourhood or from a reduced projected graph can be dumped to further processsing (see docs in module fromhnsw::toripserer). It is thus possible to produce persistence diagrams/barcodes of cloud points with the aid of the julia functions provided in the Julia directory of this crate (providing also visualization of the embedded data from the related csv files results).
Building
Blas choice
The crate provides 3 features to choose between openblas-static, intel-mkl-static or openblas-system as defined in the ndarray-linalg crate.
compile with :
cargo build --release --features="openblas-static" to link statically with rust downloaded openblas
cargo build --release --features="intel-mkl-static" to link with mkl intel's library (intel mkl will be automatically downloaded, see README.md of crate ndarray-linalg)
cargo build --release --features="openblas-system" to link with system installed openblas library. (In this case you must have an openblas library compiled with INTERFACE64=0, corresponding to 32bit fortran integers).
You can also add the feature you want in default features.
simd
On Intel cpu the you can add the simdeez_f feature to default features, or use the command cargo build --release --features="openblas-system,simdeez_f". On non intel cpu it is possible to use the stdsimd feature or "cargo build --release --features="openblas-system,stdsimd". Note that stdsimd requires the nightly compiler.
Julia
Julia scripts provide graphic functions.
Julia can be downloaded from julia. Packages mentionned by a using clause in julia sources must then be installed see Pkg. Then in a Julia REPL, include("annembed.jl") give access to functions Annembed.localPersistency and Annembed.projectedPersistency.
Possibly you will need to run export LD_PRELOAD=/lib/x86_64-linux-gnu/libstdc++.so.6 or equivalent to force Julia to use your C++ library, due to subtle interaction between GPU drivers and GLFW.jl see.
Results
Timings are given for a 24-core (32 threads) i9 laptop with 64Gb memory.
Embedder examples
Sources of examples are in corresponding directory.
MNIST digits database Cf mnist-digits
It consists in 70000 images of handwritten digits of 784 pixels
- initialized by an approximated svd.
It tooks 11s (system time) to run (cpu time 340s), of which 3s system time (100s cpu) were spent in the ann construction.

- hierarchical initialization

It took 11s to run (334s of cpu time) of which 3s were spent in the ann construction.
- The estimated intrinsic dimension of the data is 18.5 with standard deviation depending on points: 7.2 taking into account sorted neighbours around each point between the 9-th and 20-th first ranks.
MNIST fashion database Cf mnist-fashion
It consists in 70000 images of clothes.
- initialized by an approximated svd.

system time : 14s, cpu time 428s
- hierarchical initialization (This is useful for large data embedding where we initialize the embedding with first layers above the deeper populated ones of the Hnsw structure to speed up the process).

system time : 15s, cpu time 466s
- The estimated intrinsic dimension of the data is 21.9 with standard deviation depending on points is 12.2, taking into account sorted neighbours around each point between the 9-th and 20-th first ranks.
Higgs boson Cf Higgs-data
It consists in 11 millions float vectors of dimension 28. First we run on the first 21 columns, keeping out the last 7 variables constructed by the physicists to help the discrimination in machine learning tasks and then on the 28 variables.
In both cases we use hierarchical initialization. We run 200 batches in the first pass by using layers from layer 1 (included) to the upper layer. The first batches runs thus on about 460000 nodes. Then 40 batches are done on the 11 millions points.
Run times are in both cases around 2 hours (45' for the Hnsw construction and 75' for the entropy iterations)
Images for the 21 and 28 variables full data
Quality estimation requires data subsampling due to the size of data (see examples and results). Moreover a basic exploration of the data can be found in a Notebook at Higgs.jl to assess the quality of the embedding via random projections.
21 variables image:

28 variables image:

Quality estimation with a subsampling factor of 0.15
Running with subsampling factor 0.15 on the data with 28 variables (1.65 million data points) we get in 16':
nb neighbourhoods without a match : 869192, mean number of neighbours conserved when match : 5.449e0
So about half of the neighbourhoods are partially respected in the embedding.
quantiles on ratio : distance in embedded space of neighbours of origin space / distance of neighbours in embedded space
half of the original neighborhoods are embedded within a factor 1.30 of the radius of neighbourhood in embedded graph
quantiles at 0.25 : 7.87e-2, 0.5 : 1.30e0, 0.75 : 4.75e0, 0.85 : 7.94e0, 0.95 : 1.62e1
the mean ratio is : 4.36
28 variables, subsampling 0.15:

density of points obtained by transforming distance to first neighbour (See visu.jl):

Diffusion Maps with the example higgs.rs built with module diffmap .
We run on 60% of data in 700 sec(cpu), 200s(sys) and get the following image:

yellow : label 0, black label 1.
Genomics applications can be found in the following paper
Approximate nearest neighbor graph provides fast and efficient embedding with applications for large-scale biological data.
Jianshu Zhao, Jean Pierre Both, Konstantinos T Konstantinidis.
NAR Genomics and Bioinformatics, Volume 6, Issue 4, December 2024.
Usage
// allocation of a Hnsw structure to store data
let ef_c = 50;
let max_nb_connection = 70;
let nbimages = images_as_v.len();
let nb_layer = 16.min((nbimages as f32).ln().trunc() as usize);
let hnsw = Hnsw::<f32, DistL2>::new(max_nb_connection, nbimages, nb_layer, ef_c, DistL2{});
let data_with_id : Vec<(&Vec<f32>, usize)>= images_as_v.iter().zip(0..images_as_v.len()).collect();
// data insertion in the hnsw structure
hnsw.parallel_insert(&data_with_id);
// choice of embedding parameters
let mut embed_params = EmbedderParams::new();
embed_params.nb_grad_batch = 15;
embed_params.scale_rho = 1.;
embed_params.beta = 1.;
embed_params.grad_step = 1.;
embed_params.nb_sampling_by_edge = 10;
embed_params.dmap_init = true;
// conversion of the hnsw to a graph structure
let knbn = 8;
let kgraph = kgraph_from_hnsw_all(&hnsw, knbn).unwrap();
// allocation of the embedder and embedding
embedder = Embedder::new(&kgraph, embed_params);
let embed_res = embedder.embed();
Usage in Python
pip install annembed_rs
import annembed, numpy as np
arr = annembed.embed("fashion-mnist_data.csv", dim=2)
print(type(arr), arr.shape)
arr1 = annembed.dmap_embed("fashion-mnist_data.csv", dim=2)
print(type(arr1), arr.shape)
Randomized SVD
The randomized SVD is based on the paper of Halko-Tropp. The implementation covers dense matrices or matrices in compressed row storage as provided in the sprs crate.
Two algorithms for range approximation used in approximated SVD are:
subspace_iteration_csr , corresponds to algo 4.4 in Tropp paper. It uses QR stabilization.
adaptative_range_finder_matrep correponds to algo 4.2 in Tropp paper. The algorithm is less precise than subspace_iteration_csr but can work on larger matrices for example on sparse matrices with a million rows.
References
Visualizing data using t_sne. Van der Maaten and Hinton 2008.
Visualizing Large Scale High Dimensional Data Tang Liu WWW2016 2016 LargeVis
Phate Visualizing Structure and Transitions for Biological Data Exploration K.R Moon 2017.
Umap: Uniform Manifold Approximation and Projection for Dimension Reduction. L.MacInnes, J.Healy and J.Melville 2018
Stochastic Cluster Embedding. Zhirong Yang, Yuwei Chen, Denis Sedov, Samuel Kaski, Jukka Corander. Statistics and Computing 2023. SCE
Contributions
Jianshu Zhao designed the logo and implemented the Python interface.
Evolutions are described here
License
Licensed under either of
Apache License, Version 2.0, LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0
MIT license LICENSE-MIT or http://opensource.org/licenses/MIT
at your option.
Compatibility
- Runs on
- GPU support unknown
What shows it
- no dependency or feature matches a backend row
- Native code
- Required
- Binds native code: lapack-sys
- Python bindings
- Has Python bindings
- annembed needs Python only with feature python
- License
- Apache-2.0 OR MIT
Compare with similar projects
Order: strongest tier first, then most downloads, then name, with unmeasured values last. A library counts downloads over 30 days. An app counts binary downloads per release. An app with none counts its crate downloads over 30 days. ML Rust runs this catalogue, so its closest project always gets a row.
| Project | Downloads | Dependents | Stars | Latest release | Runs on (GPU) | Native code | License |
|---|---|---|---|---|---|---|---|
|
a Rust implementation of a dimension reduction à la Umap Python bindings |
799 downloads over 30 days | 4 | 45 | 0.1.6 | GPU support unknown | Binds native code: lapack-sys | Apache-2.0 OR MIT |
|
linfa Featured
A Machine Learning framework for Rust |
177,963 downloads over 30 days | 60 | 4,770 | 0.8.1 | GPU support unknown | Binds native code: lapack-sys (feature intel-mkl-static) | Apache-2.0 OR MIT |
|
A implementation of Gradient Boosting Regression Tree in Rust programming language |
6,452 downloads over 30 days | 5 | 225 | 0.1.3 | GPU support unknown | No native code found | Apache-2.0 |
|
A Rust implementation of the Leiden algorithm for community detection in large networks. |
1,765 downloads over 30 days | 1 | 1 | 0.1.0 | GPU support unknown | No native code found | MIT |
|
treeboost Listed
Gradient-boosted decision trees for tabular data: trains a baseline model in one call, with full control over boosting modes and configs, and Scalar, AVX-512, SVE2, WGPU and CUDA backends. Python bindings |
18 downloads over 30 days | 0 | 9 | 0.1.2 | CUDA, WebGPU | No native code found | Apache-2.0 |
|
Rust implementation of real-coded genetic algorithm for solving optimization problems and training of neural networks. The latter is also known as neuroevolution. |
9 downloads over 30 days | 0 | 20 | 0.2.1 | GPU support unknown | No native code found | GPL-3.0 |
|
A Rust🦀 implementation of CRAFTML, an Efficient Clustering-based Random Forest for Extreme Multi-label Learning |
Not measured | Not applicable | 15 | Not measured | Not measured | Not measured | MIT |
Why ListedNo archive, New or Featured rule places it, so it is Listed.
What it lacks for Featured
- It has 2 active dependents and 0 new dependents in 365 days. Featured needs 11 active dependents or 9 new dependents in 365 days. The repository route reads 45 stars, 8 forks and 4 contributors. It needs 4,539 stars, 434 forks and 79 contributors together.
What else the check found
- The last activity is on 28 Feb 2026, 254 days ago. The rules expect an update within 450 days. Dormancy rule
- The oldest outside issue waits 1595 days for a reply, past the limit of 270. No maintainer replied in 365 days. Rot signals rule
- The latest release requires the deprecated dependency bincode. RUSTSEC-2025-0141 Rot signals rule
Exact rules: Listed, Featured library. The check on applied thresholds version 9.
Every rule outcome, as the check records it
expected-interval: version 0.1.6 base 450: E = 450 daysdormancy: last activity 2026-02-28, 254 days ago, E = 450: activerot: oldest unanswered issue 1595 days (limit 270), no maintainer reply in 365 daysrot: deprecated requirement `bincode (RUSTSEC-2025-0141, https://rustsec.org/advisories/RUSTSEC-2025-0141.html)`featured: not featured: active_users 2 < 11 and new_adopters 0 < 9 and repository route stars 45 (needs 4539), forks 8 (needs 434), contributors 4 (needs 79)listed: listed: no archive, new or featured rule applies
Measurements and sources
Each signal row shows the raw value, its source and the fetch date. The Sources list gathers every distinct source on this page. Movement needs more history.
Sources6 sources
- Description: the crates.io description
- crates.io database dump, fetched
- RustSec advisory database, fetched
- GitHub repository, fetched
- crates.io package, fetched
- GitHub contributors, fetched
Adoption2 active dependents, 0 new dependents in 365 days1 not measured
| Signal | Value | Source | Fetched | Counts |
|---|---|---|---|---|
| Active dependents | 2 | crates.io database dump | Yes | |
| New dependents (365 days) | 0 | crates.io database dump | Yes | |
| Peak active dependents | 2 | crates.io database dump | Yes | |
| Active dependents as a share of the peak | 1 | crates.io database dump | Yes | |
| Binary downloads per release | Not measured | Yes |
MaintenanceLatest human commit: 8 months ago3 not measured
| Signal | Value | Source | Fetched | Counts |
|---|---|---|---|---|
| Latest human commit | 2026-02-28 | GitHub repository | Yes | |
| Latest release | 2025-11-19 | crates.io database dump | Yes | |
| First release | 2021-07-02 | crates.io database dump | Yes | |
| Latest version | 0.1.6 | crates.io database dump | Yes | |
| Days the oldest outside issue waits for a reply | 1595 | GitHub repository | Yes | |
| Maintainer replies over 365 days | 0 | GitHub repository | Yes | |
| Repository archived | false | GitHub repository | Yes | |
| Repository gone | false | GitHub repository | Yes | |
| Release commit or manifest in the repo | true | crates.io package | Yes | |
| Published docs | true | crates.io database dump | Yes | |
| Latest release fails cargo check | Not measured | Yes | ||
| Build check date | Not measured | Yes | ||
| Build check toolchain | Not measured | Yes |
SecurityUnpatched vulnerabilities: none
| Signal | Value | Source | Fetched | Counts |
|---|---|---|---|---|
| Unpatched vulnerabilities past the grace window | none | RustSec advisory database | Yes | |
| RustSec unmaintained advisory | none | RustSec advisory database | Yes | |
| Deprecation notice | none | crates.io database dump | Yes | |
| Deprecated requirement | bincode (RUSTSEC-2025-0141, https://rustsec.org/advisories/RUSTSEC-2025-0141.html) | crates.io database dump | Yes |
Distribution18 releases, 799 downloads over 30 days5 not measured
| Signal | Value | Source | Fetched | Counts |
|---|---|---|---|---|
| Releases | 18 | crates.io database dump | Yes | |
| Downloads over 30 days | 799 | crates.io database dump | Yes | |
| Binary downloads over the last 3 releases | Not measured | Yes | ||
| Homebrew installs on request over 365 days | Not measured | Yes | ||
| Repology repository families | Not measured | Yes | ||
| Docker pull growth over 90 days | Not measured | Yes | ||
| Docker pulls at the growth baseline | Not measured | Yes | ||
| Every version a prerelease | false | crates.io database dump | Yes | |
| Every version 0.0.x | false | crates.io database dump | Yes | |
| Every version yanked | false | crates.io database dump | Yes | |
| Crate deleted from crates.io | false | crates.io database dump | Yes |
Repository45 stars, 8 forks, 4 contributors, 393 commits. Stars alone never qualify a project.
| Signal | Value | Source | Fetched | Counts |
|---|---|---|---|---|
| GitHub stars | 45 | GitHub repository | Yes — one part of the repository route | |
| GitHub forks | 8 | GitHub repository | Yes — one part of the repository route | |
| Contributors with a GitHub account | 4 | GitHub contributors | Yes — one part of the repository route | |
| Commits on the default branch | 393 | GitHub repository | No | |
| Repository's main crate left out of the entry | none | crates.io database dump | Yes |
Facts that never count
| Signal | Value | Source | Fetched | Counts |
|---|---|---|---|---|
| License | Apache-2.0 OR MIT | crates.io database dump | No | |
| Runs on, from listed crates and their direct dependencies | GPU support unknown | crates.io database dump | No | |
| What shows each backend | no dependency or feature matches a backend row | crates.io database dump | No | |
| Native code, from listed crates and their dependencies | Binds native code: lapack-sys | crates.io database dump | No | |
| Python bindings, from direct dependencies of listed crates | Has Python bindings: annembed needs Python only with feature python | crates.io database dump | No | |
| Crates that depend on a listed crate directly | 4 | crates.io database dump | No |
Corrections and review history
No correction applies to this entry.
Judgments
A judgment enters only through an approved issue and a merged pull request.
No judgment applies to this entry.