SPORE
SPORE (Skeleton Propagation Over Recalibrating Expansions) is a graph-based clustering algorithm for nonlinear clusters under heterogeneous density and weak boundary contrast.
The Algorithm
SPORE builds a reusable k-nearest-neighbor graph, then runs two main phases:
-
Expansion: clusters are seeded from dense regions and expanded with breadth-first search over the k-NN graph. Candidate neighbors are accepted only when their distances are consistent with the growing cluster's evolving distance statistics. This lets each cluster adapt to its own local density scale while still following nonconvex shapes.
-
Small-Cluster Reassignment (SCR): clusters below
min_cluster_sizeare treated as fragments. Fragment points are reassigned to established clusters using local k-NN majority voting, with candidate neighbors filtered by cluster size and density compatibility. Any fragments still unresolved after SCR can be labeled as noise or left unchanged, depending onpost_reassignment_policy.
Installation
pip install spore-clustering
Quick Start
from spore_clustering import SPORE
labels = SPORE().fit_predict(X)
Key Parameters
| Parameter | Description |
|---|---|
z |
Z-score threshold controlling how aggressively clusters expand |
z_percentile |
Percentile-based alternative to z; ignored if z is provided |
retention_rate |
Fraction of neighbors that must pass the expansion filter for traversal to continue |
min_cluster_size |
Minimum established-cluster size; ints are absolute counts, floats are interpreted as N ** min_cluster_size |
max_z |
Maximum z-score allowed for candidate receiving-cluster neighbors during SCR |
max_z_percentile |
Percentile-based alternative to max_z; ignored if max_z is provided |
max_scr_rounds |
Maximum number of SCR propagation rounds |
post_reassignment_policy |
Whether remaining unresolved small clusters become noise or are left unchanged |
See the full API reference for all parameters.
Reusing a Precomputed Neighbor Index
dindex = SPORE.DataIndex(
connectivity=k,
neighbors=neighbors,
dists=distances,
dataset_scale=scale,
)
labels = SPORE(dindex=dindex, retention_rate=0.25).fit_predict(X)
Time Complexity
With an efficient k-NN backend and default neighbor scaling, where k ~ O(log N):
| Phase | Complexity |
|---|---|
| k-NN graph construction | O(N d log N) |
| Expansion | O(N log N) |
| SCR | O(N log N) |
In the worst case, with a bounded number of SCR rounds, the clustering phases after neighbor construction scale as O(N log N). Including approximate k-NN construction, the practical overall complexity is O(N d log N).
Scikit-learn Compatibility
SPORE follows standard scikit-learn estimator conventions: fit, fit_predict, get_params, and set_params.
Metadata
Release files for spore-clustering 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| spore_clustering-1.0.0.tar.gz | 202.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| spore_clustering-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 221.4 kB
Release files / spore_clustering-1.0.0.tar.gz
| Download URL | spore_clustering-1.0.0.tar.gz |
|---|---|
| Size | 202.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
63553582d73f49659bac9ca8cee4b41cad534ce1a2f7dc36f66e0338289dcae3
|
|
BLAKE2b-256 checksum How to use checksums |
3b87d8a075f5224d862541d19e7dc6d3fa27e6d005fa790f8b4ee8c27c0cd67f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
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 Jun 2, 2026.
Transparency logRelease files / spore_clustering-1.0.0-py3-none-any.whl
| Download URL | spore_clustering-1.0.0-py3-none-any.whl |
|---|---|
| Size | 18.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2b9c797001df3947819d21ab6d7a0a514d36c6ceaf64954ecb774e5e45cfe21c
|
|
BLAKE2b-256 checksum How to use checksums |
a857f13100fd9369a1514ebf3f06070be025f4c57d5b63f0a8775cfedbb0d400
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
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 Jun 2, 2026.
Transparency log