evoc-rs
Python bindings for evoc-rs: EVoC
clustering for high-dimensional embeddings. The Rust crate does the work. This
is a thin scikit-learn shaped layer over it.
Documentation: https://gregorlueg.github.io/evoc-rs/
Install
You can just install from PyPI.
uv pip install evoc-rs
Use
import numpy as np
import evoc_rs
rng = np.random.default_rng(0)
X = np.vstack([rng.normal(c * 20, 1, (500, 32)) for c in range(4)]).astype(np.float32)
model = evoc_rs.EVoC(n_neighbours=15).fit(X)
model.labels_ # the most persistent layer, -1 is noise
model.cluster_layers_ # (n_layers, n_samples), finest first
model.persistence_scores_ # (n_layers,), higher is more stable
Parameters go in the constructor, data goes into fit, results come off the
fitted estimator. get_params, set_params, fit and fit_predict are all
there, so it drops into scikit-learn pipelines and GridSearchCV without
scikit-learn being an install requirement.
The hierarchy is the point
Most clustering libraries hand you one labelling. EVoC hands you several, one
per granularity, ranked by how stable each is. labels_ picks the most
persistent for you, but the interesting bit is often a layer or two either side:
for layer, score in zip(model.cluster_layers_, model.persistence_scores_):
print(f"{layer.max() + 1:3d} clusters, persistence {score:.3f}")
Already know how many clusters you want? Pass approx_n_clusters and the finest
layer is binary-searched for it, returning a single layer.
model = evoc_rs.EVoC(approx_n_clusters=8).fit(X)
How it works
Six stages, all in Rust:
- Approximate kNN graph, via
ann-search-rs. - Fuzzy simplicial set over that graph.
- Label-propagation initialisation.
- UMAP-like node embedding with a repulsion term tuned by
noise_level. - MST over mutual reachability distances in the embedding.
- Cluster layers pulled out of the tree by persistence.
Clustering the embedding rather than the original space is what makes it fast and what makes the hierarchy meaningful.
kNN backends
ann_algorithm picks the backend for stage 1. nndescent is the default and
the right first choice for a self-kNN graph. exhaustive is exact, and worth it
below roughly 10k points. hnsw, annoy, ivf, kmknn and balltree are all
there if you have a reason.
Bring your own graph instead, if you already have one:
model = evoc_rs.EVoC().fit(X, precomputed_knn=(indices, distances))
Both arrays are (n_samples, k) and exclude self.
GPU
EVoCGpu moves the kNN stage onto the GPU via wgpu and leaves everything
downstream on the CPU. That only pays off when the search dominates: many
points, high dimension, or an exhaustive search. float32 only, because WGSL has
no f64.
if evoc_rs.gpu_available():
model = evoc_rs.EVoCGpu(n_neighbours=15).fit(X)
gpu_available() answers both "was this wheel built with GPU support" and "is
there an adapter here" at once. The published wheel carries it.
Threads
evoc_rs.set_num_threads(8) # cap it
evoc_rs.set_num_threads(0) # back to one per core
Credit
Port of evoc by Leland McInnes. Where behaviour diverges, the Python original is the source of truth.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file evoc_rs-0.1.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: evoc_rs-0.1.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 5.4 MB
- Tags: CPython 3.10+, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c7f4b38590557ff600e86661852e82e35fff24d52ba1e5c6968109c0bbacc6fa
|
|
| MD5 |
8dc8abed5ff00d98aaf3e849e3e5af62
|
|
| BLAKE2b-256 |
4e062e9d436b0b1a9a6f7007bbef7acb612664e768e46603c4b53ec5815852c8
|
Provenance
The following attestation bundles were made for evoc_rs-0.1.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:
Publisher:
python-release.yml on GregorLueg/evoc-rs
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
evoc_rs-0.1.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl -
Subject digest:
c7f4b38590557ff600e86661852e82e35fff24d52ba1e5c6968109c0bbacc6fa - Sigstore transparency entry: 2689386286
- Sigstore integration time:
-
Permalink:
GregorLueg/evoc-rs@7479d2c66adb7342dab341b4f3ad62e0fbfc41ca -
Branch / Tag:
refs/heads/main - Owner: https://github.com/GregorLueg
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-release.yml@7479d2c66adb7342dab341b4f3ad62e0fbfc41ca -
Trigger Event:
workflow_run
-
Statement type:
File details
Details for the file evoc_rs-0.1.0-cp310-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: evoc_rs-0.1.0-cp310-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 4.8 MB
- Tags: CPython 3.10+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d25209e7a3a3b090e81bc3b60a4b32dd3c1a71bd10c79502ad2e93467785cdbf
|
|
| MD5 |
eaa04956de2fcf937eca16bb38e4fc09
|
|
| BLAKE2b-256 |
8ae5fb3763751e8201e149b0392b839710149660035e89b0b800d6d514b08b75
|
Provenance
The following attestation bundles were made for evoc_rs-0.1.0-cp310-abi3-macosx_11_0_arm64.whl:
Publisher:
python-release.yml on GregorLueg/evoc-rs
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
evoc_rs-0.1.0-cp310-abi3-macosx_11_0_arm64.whl -
Subject digest:
d25209e7a3a3b090e81bc3b60a4b32dd3c1a71bd10c79502ad2e93467785cdbf - Sigstore transparency entry: 2689386530
- Sigstore integration time:
-
Permalink:
GregorLueg/evoc-rs@7479d2c66adb7342dab341b4f3ad62e0fbfc41ca -
Branch / Tag:
refs/heads/main - Owner: https://github.com/GregorLueg
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-release.yml@7479d2c66adb7342dab341b4f3ad62e0fbfc41ca -
Trigger Event:
workflow_run
-
Statement type:
File details
Details for the file evoc_rs-0.1.0-cp310-abi3-macosx_10_12_x86_64.whl.
File metadata
- Download URL: evoc_rs-0.1.0-cp310-abi3-macosx_10_12_x86_64.whl
- Upload date:
- Size: 5.1 MB
- Tags: CPython 3.10+, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a486cad62734708ef3824d346fb0a3c7e111384f9946ecb053bb927bfab186b0
|
|
| MD5 |
df5ba4cc78b6af99cb29a95957dd00fc
|
|
| BLAKE2b-256 |
822518d701ed24f2cd9d10995e98cf979c213b9d6a844b6fb20abe512b5b26f1
|
Provenance
The following attestation bundles were made for evoc_rs-0.1.0-cp310-abi3-macosx_10_12_x86_64.whl:
Publisher:
python-release.yml on GregorLueg/evoc-rs
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
evoc_rs-0.1.0-cp310-abi3-macosx_10_12_x86_64.whl -
Subject digest:
a486cad62734708ef3824d346fb0a3c7e111384f9946ecb053bb927bfab186b0 - Sigstore transparency entry: 2689386126
- Sigstore integration time:
-
Permalink:
GregorLueg/evoc-rs@7479d2c66adb7342dab341b4f3ad62e0fbfc41ca -
Branch / Tag:
refs/heads/main - Owner: https://github.com/GregorLueg
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-release.yml@7479d2c66adb7342dab341b4f3ad62e0fbfc41ca -
Trigger Event:
workflow_run
-
Statement type: