Skip to main content

dbscan1d is a package for DBSCAN on 1D arrays

Project description

DBSCAN1D

Coverage Supported Versions PyPI Licence

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 almost 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.6.tar.gz (5.1 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.6-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: dbscan1d-0.1.6.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.9.2

File hashes

Hashes for dbscan1d-0.1.6.tar.gz
Algorithm Hash digest
SHA256 2ac2b124c40159ddfbc37e75541eee5f59a3e769735a3168bc4271bf8cd5cf42
MD5 723a5e6bdddba144c716946daeb6b209
BLAKE2b-256 06d260451014e815c6c26743e8ffa3db8a92c7df9962d359a47000240b635823

See more details on using hashes here.

File details

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

File metadata

  • Download URL: dbscan1d-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 7.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.9.2

File hashes

Hashes for dbscan1d-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 514b4ec3f90283697b43a63115fe6f5e55f48f8f0a5c74752ae732d7c57b0475
MD5 b6af71c248cb03fa260785879b9f7a3e
BLAKE2b-256 095c867681c3a69480bf6ae753797f21529bf3a2f0b455d7578b66a244046814

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