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.1.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dbscan1d-0.1.1-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: dbscan1d-0.1.1.tar.gz
  • Upload date:
  • Size: 4.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.3

File hashes

Hashes for dbscan1d-0.1.1.tar.gz
Algorithm Hash digest
SHA256 98c4d0be6227f549ff845826d2209cbfe471976a8d4527b2b36d40679b9abcbb
MD5 b3778e24096143b02c78d31325b9c18a
BLAKE2b-256 a01617b5442a2955c67107447b404932858fc455213909ef782e9e60f7a49777

See more details on using hashes here.

File details

Details for the file dbscan1d-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: dbscan1d-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 7.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.3

File hashes

Hashes for dbscan1d-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 24602f523ff3457d2e103cd12ad61af67048135c69a462a9e6ed4c3cea50abe6
MD5 2af2b77e3482b2addbb110d022a0e75f
BLAKE2b-256 bcfac6c49e6e4296852890c9ca7bb440c760882c89990cc0f72a3af50d25ef60

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