Skip to main content

cuscan

cuscan 0.1.0 provides non-parametric UMAP dimensionality reduction and HDBSCAN clustering in Rust and Python. UMAP defaults to recursive initialization (host graph coarsening with Adam layouts at coarse levels) followed by an Adam layout, with umap-learn 0.6-style random or spectral initialization and rescaling, compatibility SGD, and momentum layouts also available; it does not implement all 0.6 features or promise bit parity. The implementation uses Burn and CubeCL for CPU and CUDA execution.

Local build

The documented local target is Linux x86-64, including WSL2. Python 3.12+, uv and Maturin are required. rust-toolchain.toml pins nightly-2026-08-08 (rustc 1a98b1e13), and the x86-64 Linux Cargo configuration requires /usr/sbin/clang and mold and enables nightly flags. From the repository root:

uv sync
uv run maturin develop --release

Use uv run --no-sync for subsequent scripts or tests so syncing does not replace the locally built extension. The CubeCL LLVM bundle/build/JIT path can require network access, cache space and LLVM support. CPU and CUDA are both compiled; CUDA execution requires a working NVIDIA runtime and device. Compilation alone does not initialize CUDA.

Wheel validation

The lowest validated Linux x86-64 wheel baseline is manylinux 2.34. The manylinux 2.28 image fails to build because tracel-llvm-23.1.0-4's llvm-config requires GLIBC 2.32, 2.33 and 2.34.

Python

import numpy as np
from cuscan import HDBSCAN, UMAP

X = np.random.default_rng(42).normal(size=(100, 10)).astype(np.float32)
mapper = UMAP(n_neighbors=15, random_state=42, backend="cpu")
embedding = mapper.fit_transform(X)
projected = mapper.transform(X[:5])

clusterer = HDBSCAN(min_cluster_size=5, backend="cpu").fit(X)
labels = clusterer.labels_
new_labels, strengths = clusterer.approximate_predict(X[:5])

Both estimators accept backend="auto", "cpu", or "cuda". Auto prefers a discovered usable CUDA device and selects CPU only when CUDA is unavailable. Explicit choices are strict; execution errors do not trigger fallback.

UMAP fit defaults to init="auto", which resolves to recursive initialization for every optimizer, including compatibility: host graph coarsening with CPU or CUDA Adam layouts at coarse levels. Rescaling defaults to init_rescale="isotropic" with init_scale_factor=1.0; "per_axis" and "graph_edge" are also available. init="spectral" and init="random" remain available. Python accepts recursive_coarsening_ratio (2, 3, or 4) and recursive_init_kwds with base_init_threshold, n_embedding_epochs, hub_selection, or anchor_sample_size. These controls do not affect transform initialization. cuscan does not promise bit parity with umap-learn; see Standard UMAP.

UMAP defaults to optimizer="adam", so a default model also transforms with Adam. Pass optimizer="compatibility", init="spectral" to get the previous defaults (classic SGD after spectral initialization). "adam" and "momentum" use source-only modern layouts for fit and transform. When the fitted reference row count (after unique=True) exceeds negative_selection_range (default 200000), layouts with more than 1024 source rows draw negatives from per-epoch random-projection windows; smaller layouts, including small transform batches, sample globally with scale 1. exclude_graph_neighbors=False controls whether graph neighbors are excluded from negatives. negative_sample_scale_adaptation_samples=128 adapts the scale during Adam fits only (0 disables); momentum and transform keep the initial scale. negative_sample_scale=None resolves the automatic scale; an explicit finite nonnegative scale is used as given (0 stays 0). Saved models retain these fit-time settings. Measured quality and performance results, and the items still open, are recorded in the Standard UMAP notes and the Phase 5 and Phase 6 gap reports; full-seed quality is not claimed. Known limitation: transform quality trails upstream umap-learn; closing that gap is Phase 7 work (see the Phase 6 gap report, item N4).

Fitted-model serialization

Install the optional HDF5 dependencies locally with uv sync --extra serialization, then rebuild with uv run maturin develop --release. The extra supplies h5py and hdf5plugin; ordinary fitting does not require them.

mapper.save("umap.h5")
restored = UMAP.load("umap.h5", backend="cpu")
projected = restored.transform(X[:5])

predictor = clusterer.to_predictor()
predictor.save("predictor.h5")

UMAP saves fitted state; HDBSCAN serialization is for HDBSCANPredictor, not the fitted estimator or its fit outputs. Load a predictor with HDBSCANPredictor.load(path, backend="auto", device_index=0). Backend and device are chosen at load time. save refuses to overwrite by default; overwrite=True explicitly replaces a file. Publication flushes a same-directory temporary file and commits atomically. On POSIX, a post-commit directory-sync failure reports uncertain durability. Windows flushes file data but does not guarantee directory-entry durability across a crash.

Files use a versioned HDF5 schema and lossless Blosc2 Zstandard compression, not pickle. External HDF5 readers need the Blosc2 filter plugin (ID 32026). Files contain training data or geometry and derived model state; protect them like the original data. Schema validation and compression do not authenticate files. Rust does not provide an HDF5 persistence API. Serialized numeric state does not guarantee identical execution across hardware, software versions or backends.

UMAP uses strict schema version 5 and rejects older UMAP files; retrain and save them in the new format. HDBSCAN predictor files remain version 1. There are no compatibility aliases for prior imports, crates or environment variables.

Rust

The workspace exposes the umap and hdbscan facades. Build and test them locally:

cargo build --release -p umap -p hdbscan
cargo test -p umap
cargo test -p hdbscan

See development and analysis for Rust API examples, detailed backend behavior, profiling, comparisons, serialization benchmarks and testing guidance. Historical benchmark measurements there are not cuscan rebenchmarks.

The CI and release guidance describes the intended ci-ok gate, local act, independent CUDA validation, trusted publishing and the maintainer's settings checklist.

Releases use one reviewed Release Please PR and a shared Cargo/Python version. Squash PRs with Conventional Commit titles (feat:, fix:, or feat!: for a breaking change). Before 1.0, breaking changes bump minor. Merging the release PR creates the public GitHub release first; PyPI artifacts arrive only after the separate cold-build publishing workflow succeeds. A GitHub release alone is not proof of publication. See the activation checklist.

Unmodified engineering reports are retained under archive/engineering/; its index.json maps original paths to archived files and records their content hashes. Their commands, identities and source paths describe historical revisions, not the current checkout.

References and acknowledgements

License

The project is declared MIT; see LICENSE for the retained legal notice. THIRD_PARTY_NOTICES contains scoped upstream notices and provenance limitations. Upstream provenance and bundled-native notices require review separately from the project's maintainer identity; see migration_provenance.json for unresolved questions.

Metadata

Release files for cuscan 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cuscan 0.1.3
File Size Uploaded Provenance Actions
cuscan-0.1.3.tar.gz 3.2 MB With provenance Details for cuscan-0.1.3.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for cuscan 0.1.3
File Interpreter ABI Platform Actions
cuscan-0.1.3-cp312-abi3-win_amd64.whl CPython 3.12 abi3 Windows x86-64 Details for cuscan-0.1.3-cp312-abi3-win_amd64.whl
cuscan-0.1.3-cp312-abi3-manylinux_2_34_x86_64.whl CPython 3.12 abi3 Linux glibc 2.34+ x86-64 Details for cuscan-0.1.3-cp312-abi3-manylinux_2_34_x86_64.whl

Total release size: 99.8 MB

Release files / cuscan-0.1.3.tar.gz

Download URL cuscan-0.1.3.tar.gz
Size 3.2 MB
Tags Source
SHA-256 checksum
How to use checksums
184bd01c2ba051a79715d3979d635c7b588a93e065601498df8497055f80fa3f
BLAKE2b-256 checksum
How to use checksums
fd4032355d09cffaf803ad59335b7866359e53b0eb9dd5c44d4d1ac3da01c7c2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.

Transparency log

Release files / cuscan-0.1.3-cp312-abi3-win_amd64.whl

Download URL cuscan-0.1.3-cp312-abi3-win_amd64.whl
Size 44.6 MB
Tags CPython 3.12 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
8945b097aed15c381de0ea7cfae0a36e85bed45fd159aaa5bd1b29a1b463bbd6
BLAKE2b-256 checksum
How to use checksums
8a9f56363567a4ce5f72daed5338d842719afe2c1f6db8541d53602db5f629d7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.

Transparency log

Release files / cuscan-0.1.3-cp312-abi3-manylinux_2_34_x86_64.whl

Download URL cuscan-0.1.3-cp312-abi3-manylinux_2_34_x86_64.whl
Size 52.0 MB
Tags CPython 3.12 Linux glibc 2.34+ x86-64 abi3
SHA-256 checksum
How to use checksums
534b7033cfb9b8fc8947dba0bef1bdce7716a446a768d5a887fd94e670849d4b
BLAKE2b-256 checksum
How to use checksums
8aaf89bdfdeae3aded5475a7988e7ac6b052d221ba392f9aabb64a4008cbf88a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.

Transparency log

Security for cuscan 0.1.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 3 files in this release have been uploaded with provenance metadata.

Select from 3 files

Attestation for cuscan-0.1.3.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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