Skip to main content

manifolds-rs

Dimensionality reduction for single-cell and computational biology. The Rust crate does the work; this is a scikit-learn shaped layer over it.

Seven algorithms on the CPU, three of them with GPU variants where the neighbour search and the Adam update move to the device. No CUDA runtime to install: the GPU backend is wgpu, so it runs on Metal, Vulkan or DX12 and ships in the ordinary wheel.

Install

uv pip install manifolds-rs

Wheels are built for Linux x86_64 and macOS on both architectures, against Python 3.10 and up.

Thirty seconds

import manifolds_rs as mf

X, labels = mf.datasets.clustered(20_000, dim=50, n_clusters=12)

embedding = mf.UMAP(n_neighbors=15, min_dist=0.1).fit_transform(X)

Every estimator takes its parameters in the constructor, its data in fit, and hands back an (n_samples, n_components) array. get_params and set_params are there, so clone and Pipeline work without scikit-learn being an install requirement.

What's here

Class What it is for
UMAP The default choice. Local structure, decent global structure from the spectral init.
DensMAP UMAP with relative density preserved, so a dense region stays dense.
TSNE Local structure above all else. Barnes-Hut, 2-D only.
DensNE t-SNE with the same density correction.
PHATE Continuous structure. Trajectories and branch points survive this.
PaCMAP Global structure without leaning on a spectral init. Three pair types.
DiffusionMaps The spectral embedding PHATE is built on.
UMAPGpu, DensMAPGpu, TSNEGpu The same, with the neighbour search on the device.

Parameters

The knobs people actually turn are ordinary constructor arguments. The rest live in frozen dataclasses, one per group, and anything you leave alone keeps the crate's default:

mf.UMAP(
    n_neighbors=30,
    ann="hnsw",
    nn_params=mf.NeighbourParams(m=32, ef_search=200),
    optim_params=mf.UmapOptim(gamma=1.5, neg_sample_rate=10),
)

Every parameter has exactly one home. If it is a constructor argument it is not in the group, so there is never a question of which wins.

Reusing the neighbour graph

Running several embeddings over the same data? Build the graph once. On anything large the search is most of the runtime.

ind, dist = mf.knn_graph(X, k=15, ann="hnsw")

a = mf.UMAP().fit_transform(X, knn_indices=ind, knn_distances=dist)
b = mf.PaCMAP().fit_transform(X, knn_indices=ind, knn_distances=dist)

No transform

None of these projects new points, so there is no transform. That is the crate's position rather than a gap in the bindings: embedding new data means refitting on the combined set, which moves the existing coordinates too. Anyone telling you otherwise is doing something to the new points that is not the same operation the old ones went through.

Precision

float32 in, float32 throughout; float64 in, float64 throughout. Anything else is promoted to float64 rather than narrowed, so precision is never lost by accident. The GPU estimators are the exception and cast to float32, because WGSL has no float64 and the alternative is a failure inside a kernel.

What is not in the wheel

FFT-accelerated t-SNE. It needs FFTW, a system library no manylinux container carries, so approx="fft" raises unless you build the extension yourself with the fft_tsne feature. Barnes-Hut is the default and is what the wheel does.

Parametric UMAP is in the crate but not yet bound.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

manifolds_rs-0.1.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (6.0 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ x86-64

manifolds_rs-0.1.0-cp310-abi3-macosx_11_0_arm64.whl (5.4 MB view details)

Uploaded CPython 3.10+macOS 11.0+ ARM64

manifolds_rs-0.1.0-cp310-abi3-macosx_10_12_x86_64.whl (5.7 MB view details)

Uploaded CPython 3.10+macOS 10.12+ x86-64

File details

Details for the file manifolds_rs-0.1.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for manifolds_rs-0.1.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8e2af77f81e01f4fb109b4c118a570f6b7b9252acf91ed5770d6d3708750c7f7
MD5 9551e455bab90cac4c5176b0b3bcb422
BLAKE2b-256 ce50f4633b5d08b160bdc24fb48ebaf97d3d60e3b9412b391fedb1096d66458b

See more details on using hashes here.

Provenance

The following attestation bundles were made for manifolds_rs-0.1.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: python-release.yml on GregorLueg/manifolds-rs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file manifolds_rs-0.1.0-cp310-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for manifolds_rs-0.1.0-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f0fe05ad2dbe62f6bf3b20a2b0a3d78fd600f46f63687283d610f1961a30c06a
MD5 d2767ddfed1b76db6d80ab5bd0231b04
BLAKE2b-256 8c635b8198c3f8645d78c775b4dd2fced2e04834daa8710b52f765e3b53faf5c

See more details on using hashes here.

Provenance

The following attestation bundles were made for manifolds_rs-0.1.0-cp310-abi3-macosx_11_0_arm64.whl:

Publisher: python-release.yml on GregorLueg/manifolds-rs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file manifolds_rs-0.1.0-cp310-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for manifolds_rs-0.1.0-cp310-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 76a2b95fd0ea4a39999396ef50dc6bd4d819e86cc7e2a704abc4cdaea788ed52
MD5 d6337f05e349461b9eef1901d0e9307a
BLAKE2b-256 744feaa5d5ba36d260982de4fcc432e0ad180f092ef7577fc4fd318b148f7457

See more details on using hashes here.

Provenance

The following attestation bundles were made for manifolds_rs-0.1.0-cp310-abi3-macosx_10_12_x86_64.whl:

Publisher: python-release.yml on GregorLueg/manifolds-rs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.1.0 This release

3 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page