Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

DbscanFitPredict

Clusterer sklearn-compatible 🔮 Clustering

DBSCAN — density-based spatial clustering, no preset number of clusters. / DBSCAN — clustering spatial basé sur la densité, sans nombre de clusters prédéfini.

⚡ Rust-native ✓ sklearn parity
Quick start — Python
import seraplot as sp, numpy as np
from sklearn.datasets import make_blobs
X, _ = make_blobs(n_samples=300, centers=4, cluster_std=0.6)
result = sp.DBSCAN(eps=0.8, min_samples=5).fit_predict(X)
print(result)
💡
EN — Drop-in replacement: sp.DbscanFitPredict has the same API as sklearn.
FR — Remplacement direct : même API que sklearn, changez l'import.

API Reference

JSON function name

ml_dbscan_fit_predict — aliases: dbscan_fit_predict, ml_dbscan

Python class
sp.DbscanFitPredict(eps=0.5, min_samples=5)
Constructor Parameters
ParameterTypeDefaultDescription
epsfloat0.5Neighbourhood radius.
min_samplesint5Minimum points to form a core point.
Returns

JSON with labels (−1 = noise), n_clusters, n_noise.

Algorithm

A point $p$ is a core point if $|\mathcal{N}_{\varepsilon}(p)| \geq m$. Clusters are connected components of core points.

Example
import seraplot as sp, numpy as np
from sklearn.datasets import make_blobs
X, _ = make_blobs(n_samples=300, centers=4, cluster_std=0.6)
result = sp.DBSCAN(eps=0.8, min_samples=5).fit_predict(X)
print(result)

Référence API

Nom de fonction JSON

ml_dbscan_fit_predict — alias : dbscan_fit_predict, ml_dbscan

Classe Python
sp.DbscanFitPredict(eps=0.5, min_samples=5)
Paramètres du constructeur
ParamètreTypeDéfautDescription
epsfloat0.5Rayon de voisinage.
min_samplesint5Minimum de points pour former un point noyau.
Retourne

JSON avec labels (−1 = bruit), n_clusters, n_noise.

Algorithme

Un point $p$ est un point noyau si $|\mathcal{N}_{\varepsilon}(p)| \geq m$. Les clusters sont des composantes connexes de points noyaux.

Exemple
import seraplot as sp, numpy as np
from sklearn.datasets import make_blobs
X, _ = make_blobs(n_samples=300, centers=4, cluster_std=0.6)
result = sp.DBSCAN(eps=0.8, min_samples=5).fit_predict(X)
print(result)