Skip to main content

DBSCAN1D

Coverage Supported Versions PyPI Licence

dbscan1d is a 1D implementation of the DBSCAN algorithm. It was created to efficiently perform clustering on large 1D arrays.

Sci-kit Learn's DBSCAN implementation does not have a special case for 1D, where calculating the full distance matrix is wasteful. It is much better to simply sort the input array and perform efficient bisects for finding closest points. Here are the results of running the simple profile script included with the package. In every case DBSCAN1D is much faster than scikit learn's implementation.

image

Installation

Simply use pip to install dbscan1d:

pip install dbscan1d

It only requires numpy.

Quickstart

dbscan1d is designed to be interchangeable with sklearn's implementation in almost all cases.

from sklearn.datasets import make_blobs

from dbscan1d.core import DBSCAN1D

# make blobs to test clustering
X = make_blobs(1_000_000, centers=2, n_features=1)[0]

# init dbscan object
dbs = DBSCAN1D(eps=.5, min_samples=4)

# get labels for each point
labels = dbs.fit_predict(X)

# show core point indices
dbs.core_sample_indices_

# get values of core points
dbs.components_

Notes

  • dbscan1d can return different group numbers than sklearn for non-core points which are within eps distances of core points for two separate groups. For example: --C1--C1--P--C2--C2 Here C1 and C2 are core points for group 1 and group 2, respectively. If P is within eps of both C1 and C2, dbscan1d will assign it the same label as the core point that is closest. Sklearn doesn't always do this.

Metadata

Release files for dbscan1d 0.2.4

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

Source distribution (sdist)

Source distribution for dbscan1d 0.2.4
File Size Uploaded Provenance Actions
dbscan1d-0.2.4.tar.gz 12.3 kB Without provenance Details for dbscan1d-0.2.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for dbscan1d 0.2.4
File Interpreter ABI Platform Actions
dbscan1d-0.2.4-py3-none-any.whl Python 3 none any Details for dbscan1d-0.2.4-py3-none-any.whl

Total release size: 22.7 kB

Release files / dbscan1d-0.2.4.tar.gz

Download URL dbscan1d-0.2.4.tar.gz
Size 12.3 kB
Tags Source
SHA-256 checksum
How to use checksums
41d39f93b3e3aa1b683000529712f08a9ac9e7c0f700e25b4ad3d5ccd6f94a34
BLAKE2b-256 checksum
How to use checksums
5fdf3a228be0fc71d4b2abe70b8e570e368d122144e7b0a2f54ad589a76a412c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / dbscan1d-0.2.4-py3-none-any.whl

Download URL dbscan1d-0.2.4-py3-none-any.whl
Size 10.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
65b4dfcce99683c6e43b1773603e3d1cdec2383ac550aeeca9d9401d735dae52
BLAKE2b-256 checksum
How to use checksums
a2c1f1a83805e38ada809c7838749ec267daf96b7340f732596523a3faaf62ef
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Security for dbscan1d 0.2.4

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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