A fast multi-core implementation of the PLSCAN clustering algorithm.
Project description
Persistent Leaves Spatial Clustering for Applications with Noise
This library provides a new clustering algorithm based on HDBSCAN*. The primary
advantages of PLSCAN over the
hdbscan and
fast_hdbscan libraries are:
- PLSCAN automatically finds the optimal minimum cluster size.
- PLSCAN can easily use all available cores to speed up computation.
- PLSCAN has much faster implementations of tree condensing and cluster extraction.
- PLSCAN does not rely on JIT compilation.
To use PLSCAN, you only need to set the min_samples parameter. This
parameter controls how many neighbors are considered when measuring distances
between points. Setting a higher value for min_samples makes the algorithm
group points into larger, smoother clusters, and usually results in fewer, more
stable clusters.
import numpy as np
import matplotlib.pyplot as plt
from fast_plscan import PLSCAN
data = np.load("docs/data/data.npy")
clusterer = PLSCAN(
min_samples = 5, # same as in HDBSCAN
).fit(data)
plt.figure()
plt.scatter(
*data.T, c=clusterer.labels_ % 10, s=5, alpha=0.5,
edgecolor="none", cmap="tab10", vmin=0, vmax=9
)
plt.axis("off")
plt.subplots_adjust(left=0, right=1, top=1, bottom=0)
plt.show()
The algorithm creates a hierarchy of leaf-clusters by changing the minimum
cluster size. As this parameter varies, clusters appear or disappear. For each
minimum cluster size, the algorithm measures how long these leaf-clusters
persist. It then selects the minimum cluster size where the total persistence is
highest, giving the most stable clustering. You can visualize this hierarchy
using the leaf_tree_ attribute, which provides an alternative to HDBSCAN*'s
condensed cluster tree.
clusterer.leaf_tree_.plot(leaf_separation=0.1)
plt.show()
You can also explore how the clustering changes for other important values of
the minimum cluster size. The cluster_layers method automatically finds the
most persistent clusterings and returns their cluster labels and membership
strengths.
layers = clusterer.cluster_layers(max_peaks=4)
for i, (size, labels, probs) in enumerate(layers):
plt.subplot(2, 2, i + 1)
plt.scatter(
*data.T,
c=labels % 10,
alpha=np.maximum(0.1, probs),
s=1,
linewidth=0,
cmap="tab10",
)
plt.title(f"min_cluster_size={int(size)}")
plt.axis("off")
plt.subplots_adjust(left=0, right=1, top=1, bottom=0)
plt.show()
Installation instructions
Pre-build binaries are available on pypi, so the package can be installed with pip and similar package managers on most systems:
pip install fast_plscan
Conda forge builds are in progress. See our documentation for instructions on compiling the package locally.
Citing
When using this work, please cite our preprint:
@misc{bot2025plscan,
title = {Persistent Multiscale Density-based Clustering},
author = {Dani{\"{e}}l Bot and Leland McInnes and Jan Aerts},
year = {2025},
eprint = {2512.16558},
archiveprefix = {arXiv},
primaryclass = {cs.LG},
url = {https://arxiv.org/abs/2512.16558}
}
Licensing
The fast-plscan package has a 3-Clause BSD license.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
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 fast_plscan-0.1.0.post2.tar.gz.
File metadata
- Download URL: fast_plscan-0.1.0.post2.tar.gz
- Upload date:
- Size: 273.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8017fb8a02982bf9b18bf214f319ea63d16e9e4b31a92bc6b02e490b81e5adf1
|
|
| MD5 |
2bd52df97780fb0f539ee528623e786e
|
|
| BLAKE2b-256 |
b836d58dcce2c276915d7ec0b72e1d1883103a204469450fa29c1efc002f666f
|
Provenance
The following attestation bundles were made for fast_plscan-0.1.0.post2.tar.gz:
Publisher:
release.yml on JelmerBot/fast_plscan
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fast_plscan-0.1.0.post2.tar.gz -
Subject digest:
8017fb8a02982bf9b18bf214f319ea63d16e9e4b31a92bc6b02e490b81e5adf1 - Sigstore transparency entry: 813610731
- Sigstore integration time:
-
Permalink:
JelmerBot/fast_plscan@b7bfd406291c1b766640b725f28951386167b0aa -
Branch / Tag:
refs/tags/v0.1.0.post2 - Owner: https://github.com/JelmerBot
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@b7bfd406291c1b766640b725f28951386167b0aa -
Trigger Event:
push
-
Statement type:
File details
Details for the file fast_plscan-0.1.0.post2-cp312-abi3-win_amd64.whl.
File metadata
- Download URL: fast_plscan-0.1.0.post2-cp312-abi3-win_amd64.whl
- Upload date:
- Size: 644.5 kB
- Tags: CPython 3.12+, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b671f61885e3e26d5cfcacece642fa29473d38ce0bf528a731a49f12247dbbd4
|
|
| MD5 |
09e4c191abf8b8f1aef3a9e9b7e75fd7
|
|
| BLAKE2b-256 |
86a2eb2b552dcc0b15f842a93efd5c47b5800c88fa06fdcc04d369dbd37c26ea
|
Provenance
The following attestation bundles were made for fast_plscan-0.1.0.post2-cp312-abi3-win_amd64.whl:
Publisher:
release.yml on JelmerBot/fast_plscan
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fast_plscan-0.1.0.post2-cp312-abi3-win_amd64.whl -
Subject digest:
b671f61885e3e26d5cfcacece642fa29473d38ce0bf528a731a49f12247dbbd4 - Sigstore transparency entry: 813610740
- Sigstore integration time:
-
Permalink:
JelmerBot/fast_plscan@b7bfd406291c1b766640b725f28951386167b0aa -
Branch / Tag:
refs/tags/v0.1.0.post2 - Owner: https://github.com/JelmerBot
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@b7bfd406291c1b766640b725f28951386167b0aa -
Trigger Event:
push
-
Statement type:
File details
Details for the file fast_plscan-0.1.0.post2-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.
File metadata
- Download URL: fast_plscan-0.1.0.post2-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
- Upload date:
- Size: 319.3 kB
- Tags: CPython 3.12+, manylinux: glibc 2.27+ x86-64, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d81ff852234da9547da86ca928bb08f3a1fb6c4973ed1f75c294abd7cd0f7ac7
|
|
| MD5 |
77dab55094aa0de2dab4684aa2f6845f
|
|
| BLAKE2b-256 |
1a2365a1653cdd77977f8c415d229bf837157476f044a15b5c82e1c44561b948
|
Provenance
The following attestation bundles were made for fast_plscan-0.1.0.post2-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:
Publisher:
release.yml on JelmerBot/fast_plscan
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fast_plscan-0.1.0.post2-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl -
Subject digest:
d81ff852234da9547da86ca928bb08f3a1fb6c4973ed1f75c294abd7cd0f7ac7 - Sigstore transparency entry: 813610734
- Sigstore integration time:
-
Permalink:
JelmerBot/fast_plscan@b7bfd406291c1b766640b725f28951386167b0aa -
Branch / Tag:
refs/tags/v0.1.0.post2 - Owner: https://github.com/JelmerBot
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@b7bfd406291c1b766640b725f28951386167b0aa -
Trigger Event:
push
-
Statement type:
File details
Details for the file fast_plscan-0.1.0.post2-cp312-abi3-macosx_15_0_arm64.whl.
File metadata
- Download URL: fast_plscan-0.1.0.post2-cp312-abi3-macosx_15_0_arm64.whl
- Upload date:
- Size: 407.7 kB
- Tags: CPython 3.12+, macOS 15.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e91b8ebb526dea3d0a5a7b2bfeedd0351a6083c9ec8a3109852c579fe4128e84
|
|
| MD5 |
df49a96aa3ff501be4d1e54771122a74
|
|
| BLAKE2b-256 |
930145041abbaef3a7e389f52358867f81c88ff4b9a2e846c2ea4e7528248232
|
Provenance
The following attestation bundles were made for fast_plscan-0.1.0.post2-cp312-abi3-macosx_15_0_arm64.whl:
Publisher:
release.yml on JelmerBot/fast_plscan
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fast_plscan-0.1.0.post2-cp312-abi3-macosx_15_0_arm64.whl -
Subject digest:
e91b8ebb526dea3d0a5a7b2bfeedd0351a6083c9ec8a3109852c579fe4128e84 - Sigstore transparency entry: 813610738
- Sigstore integration time:
-
Permalink:
JelmerBot/fast_plscan@b7bfd406291c1b766640b725f28951386167b0aa -
Branch / Tag:
refs/tags/v0.1.0.post2 - Owner: https://github.com/JelmerBot
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@b7bfd406291c1b766640b725f28951386167b0aa -
Trigger Event:
push
-
Statement type:
File details
Details for the file fast_plscan-0.1.0.post2-cp311-cp311-win_amd64.whl.
File metadata
- Download URL: fast_plscan-0.1.0.post2-cp311-cp311-win_amd64.whl
- Upload date:
- Size: 646.5 kB
- Tags: CPython 3.11, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
53f46a9ed7882920ad78a066f706365806e90e2f017f9009acaddb5ba66265c8
|
|
| MD5 |
6dfe32f35a3e00af664f75a22c215ce5
|
|
| BLAKE2b-256 |
10370b5433e4868b0ff75fd209d67ea3f3a86bd95c66c192510259c5b708e94d
|
Provenance
The following attestation bundles were made for fast_plscan-0.1.0.post2-cp311-cp311-win_amd64.whl:
Publisher:
release.yml on JelmerBot/fast_plscan
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fast_plscan-0.1.0.post2-cp311-cp311-win_amd64.whl -
Subject digest:
53f46a9ed7882920ad78a066f706365806e90e2f017f9009acaddb5ba66265c8 - Sigstore transparency entry: 813610744
- Sigstore integration time:
-
Permalink:
JelmerBot/fast_plscan@b7bfd406291c1b766640b725f28951386167b0aa -
Branch / Tag:
refs/tags/v0.1.0.post2 - Owner: https://github.com/JelmerBot
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@b7bfd406291c1b766640b725f28951386167b0aa -
Trigger Event:
push
-
Statement type:
File details
Details for the file fast_plscan-0.1.0.post2-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.
File metadata
- Download URL: fast_plscan-0.1.0.post2-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
- Upload date:
- Size: 322.8 kB
- Tags: CPython 3.11, manylinux: glibc 2.27+ x86-64, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
705a3f356d513906f1b10842d82d98b8891018afb7208ac8063b3e4e4683e501
|
|
| MD5 |
be40987f8369318684a679379824e003
|
|
| BLAKE2b-256 |
75fc2e08249a334c02e77ef088e40647eeb799ca9e148ed0aa78f066f62db919
|
Provenance
The following attestation bundles were made for fast_plscan-0.1.0.post2-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:
Publisher:
release.yml on JelmerBot/fast_plscan
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fast_plscan-0.1.0.post2-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl -
Subject digest:
705a3f356d513906f1b10842d82d98b8891018afb7208ac8063b3e4e4683e501 - Sigstore transparency entry: 813610736
- Sigstore integration time:
-
Permalink:
JelmerBot/fast_plscan@b7bfd406291c1b766640b725f28951386167b0aa -
Branch / Tag:
refs/tags/v0.1.0.post2 - Owner: https://github.com/JelmerBot
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@b7bfd406291c1b766640b725f28951386167b0aa -
Trigger Event:
push
-
Statement type:
File details
Details for the file fast_plscan-0.1.0.post2-cp311-cp311-macosx_15_0_arm64.whl.
File metadata
- Download URL: fast_plscan-0.1.0.post2-cp311-cp311-macosx_15_0_arm64.whl
- Upload date:
- Size: 407.9 kB
- Tags: CPython 3.11, macOS 15.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
602ac937ad63b19348e2e2b8f4985c445e63b2071b81701e7e09526683fb6a62
|
|
| MD5 |
27dbf92dbd2655294abc4713085e022b
|
|
| BLAKE2b-256 |
7de60f797a70a67d8cb7acf964e53a4e4112f52fc302d9528000e99bb3f0bc4d
|
Provenance
The following attestation bundles were made for fast_plscan-0.1.0.post2-cp311-cp311-macosx_15_0_arm64.whl:
Publisher:
release.yml on JelmerBot/fast_plscan
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fast_plscan-0.1.0.post2-cp311-cp311-macosx_15_0_arm64.whl -
Subject digest:
602ac937ad63b19348e2e2b8f4985c445e63b2071b81701e7e09526683fb6a62 - Sigstore transparency entry: 813610743
- Sigstore integration time:
-
Permalink:
JelmerBot/fast_plscan@b7bfd406291c1b766640b725f28951386167b0aa -
Branch / Tag:
refs/tags/v0.1.0.post2 - Owner: https://github.com/JelmerBot
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@b7bfd406291c1b766640b725f28951386167b0aa -
Trigger Event:
push
-
Statement type:
File details
Details for the file fast_plscan-0.1.0.post2-cp310-cp310-win_amd64.whl.
File metadata
- Download URL: fast_plscan-0.1.0.post2-cp310-cp310-win_amd64.whl
- Upload date:
- Size: 646.9 kB
- Tags: CPython 3.10, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c471bf9d296e20009c17f7674b992b4310dfc9ca0fc83ba270ead63acbb9956a
|
|
| MD5 |
87eb1215f83a3ec1ceb3867bc37880b9
|
|
| BLAKE2b-256 |
9df678e5ab04fec184e3b04ad1a3c5fb61ca99f4e6574589a8b31333d0fa3b09
|
Provenance
The following attestation bundles were made for fast_plscan-0.1.0.post2-cp310-cp310-win_amd64.whl:
Publisher:
release.yml on JelmerBot/fast_plscan
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fast_plscan-0.1.0.post2-cp310-cp310-win_amd64.whl -
Subject digest:
c471bf9d296e20009c17f7674b992b4310dfc9ca0fc83ba270ead63acbb9956a - Sigstore transparency entry: 813610742
- Sigstore integration time:
-
Permalink:
JelmerBot/fast_plscan@b7bfd406291c1b766640b725f28951386167b0aa -
Branch / Tag:
refs/tags/v0.1.0.post2 - Owner: https://github.com/JelmerBot
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@b7bfd406291c1b766640b725f28951386167b0aa -
Trigger Event:
push
-
Statement type:
File details
Details for the file fast_plscan-0.1.0.post2-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.
File metadata
- Download URL: fast_plscan-0.1.0.post2-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
- Upload date:
- Size: 323.0 kB
- Tags: CPython 3.10, manylinux: glibc 2.27+ x86-64, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8cf3a3f45a167ce9f50466a970daa8c7e09b8a2d7e61587dec81d3b4cca4a3aa
|
|
| MD5 |
74f150979315bf43add247256113a3e6
|
|
| BLAKE2b-256 |
05f2760d1e7a59421a08203f29385b9a3bc9c10452f1c2ab11e3ef5a6deb59e2
|
Provenance
The following attestation bundles were made for fast_plscan-0.1.0.post2-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:
Publisher:
release.yml on JelmerBot/fast_plscan
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fast_plscan-0.1.0.post2-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl -
Subject digest:
8cf3a3f45a167ce9f50466a970daa8c7e09b8a2d7e61587dec81d3b4cca4a3aa - Sigstore transparency entry: 813610739
- Sigstore integration time:
-
Permalink:
JelmerBot/fast_plscan@b7bfd406291c1b766640b725f28951386167b0aa -
Branch / Tag:
refs/tags/v0.1.0.post2 - Owner: https://github.com/JelmerBot
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@b7bfd406291c1b766640b725f28951386167b0aa -
Trigger Event:
push
-
Statement type:
File details
Details for the file fast_plscan-0.1.0.post2-cp310-cp310-macosx_15_0_arm64.whl.
File metadata
- Download URL: fast_plscan-0.1.0.post2-cp310-cp310-macosx_15_0_arm64.whl
- Upload date:
- Size: 408.1 kB
- Tags: CPython 3.10, macOS 15.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d2534c6ad9b354b529d2ba8b10d54011be9c40fd473a5ea07b6cad2f7e7b003e
|
|
| MD5 |
c5435e3850cfd70830ee8538b606e9a8
|
|
| BLAKE2b-256 |
ede80dc840475cdf7fbb5ca64969b8ca310387e7aa8c85727fad142189de8b9b
|
Provenance
The following attestation bundles were made for fast_plscan-0.1.0.post2-cp310-cp310-macosx_15_0_arm64.whl:
Publisher:
release.yml on JelmerBot/fast_plscan
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fast_plscan-0.1.0.post2-cp310-cp310-macosx_15_0_arm64.whl -
Subject digest:
d2534c6ad9b354b529d2ba8b10d54011be9c40fd473a5ea07b6cad2f7e7b003e - Sigstore transparency entry: 813610737
- Sigstore integration time:
-
Permalink:
JelmerBot/fast_plscan@b7bfd406291c1b766640b725f28951386167b0aa -
Branch / Tag:
refs/tags/v0.1.0.post2 - Owner: https://github.com/JelmerBot
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@b7bfd406291c1b766640b725f28951386167b0aa -
Trigger Event:
push
-
Statement type: