https://github.com/gbroques/dbscan
DBSCAN density-based clustering algorithm in Python.
https://github.com/gbroques/dbscan
clustering-algorithm dbscan dbscan-clustering density-based-clustering eps python python-3
Last synced: 7 months ago
JSON representation
DBSCAN density-based clustering algorithm in Python.
- Host: GitHub
- URL: https://github.com/gbroques/dbscan
- Owner: gbroques
- License: mit
- Created: 2018-04-22T23:30:40.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2022-12-08T00:59:24.000Z (almost 3 years ago)
- Last Synced: 2025-04-08T01:51:17.299Z (8 months ago)
- Topics: clustering-algorithm, dbscan, dbscan-clustering, density-based-clustering, eps, python, python-3
- Language: Jupyter Notebook
- Size: 290 KB
- Stars: 10
- Watchers: 2
- Forks: 1
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# DBSCAN
[](https://travis-ci.org/gbroques/dbscan)
[](https://coveralls.io/github/gbroques/dbscan?branch=master)
Density-Based Spatial Clustering of Applications with Noise (DBSCAN) implementation in Python.
API inspired by Scikit-learn.
## Usage
```python
import numpy as np
from dataviz import generate_clusters
from dataviz import plot_clusters
from dbscan import DBSCAN
def generate_data(num_clusters: int, seed=None) -> np.ndarray:
num_points = 20
spread = 7
bounds = (1, 100)
clusters = generate_clusters(num_clusters, num_points, spread, bounds, bounds, seed)
return np.array(clusters)
num_clusters = 4
clusters = generate_data(num_clusters, seed=1)
dbscan = DBSCAN(eps=7, min_samples=5)
dbscan.fit(clusters)
plot_clusters(clusters, dbscan.labels_, dbscan.components_)
```

* Red crosses denote **core points**
**Reference:** *Introduction to Data Mining* (1st Edition) by Pang-Ning Tan
Section 8.4, Page 526
**Original Paper:** Ester, Martin, Hans-Peter Kriegel, Jörg Sander, and Xiaowei Xu. "A density-based algorithm for discovering clusters in large spatial databases with noise." In Kdd, vol. 96, no. 34, pp. 226-231. 1996.