Skip to main content

dbscan1d is a package for DBSCAN on 1D arrays

Project description

DBSCAN1D

dbscan1d is a 1D implementation of the DBSCAN algorithm. It was created to efficiently preform 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 performing 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 interchangable with sklearn's implementation in alnmost all cases. The exception is that the weights parameter is not yet supported.

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_

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dbscan1d-0.1.3.tar.gz (4.6 kB view details)

Uploaded Source

File details

Details for the file dbscan1d-0.1.3.tar.gz.

File metadata

  • Download URL: dbscan1d-0.1.3.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.8

File hashes

Hashes for dbscan1d-0.1.3.tar.gz
Algorithm Hash digest
SHA256 5aca24f9cf51916acb47f499e044d4712fbfc0e7caebb09071e4d02d67332955
MD5 45cb22c9098852eea785ebc584a4d3da
BLAKE2b-256 2f67cee89c194c6a10b1a43d7eb4d197364d7bdd7adc6192207ecc8a193108a2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page