Learn R Programming

daltoolbox (version 1.3.767)

cluster_dbscan: DBSCAN

Description

Density-Based Spatial Clustering of Applications with Noise using dbscan::dbscan.

Usage

cluster_dbscan(minPts = 3, eps = NULL)

Value

returns a dbscan object

Arguments

minPts

minimum number of points

eps

distance value

Details

Discovers clusters as dense regions separated by sparse areas. Hyperparameters are eps (neighborhood radius) and minPts (minimum points). If eps is missing, it is estimated from the kNN distance curve elbow.

The base clusterer() uses wcss as a generic default, but cluster_dbscan() specializes that choice because DBSCAN does not force a centroid-based partition and can label observations as noise.

Default evaluation in cluster_dbscan() is:

  • main metric: metric_noise_points()

  • internal evaluation: noise_points

  • external evaluation: entropy, purity, adjusted_rand_index

The general wcss fallback is not used as the main metric because it ignores the central modeling choice of DBSCAN: distinguishing dense clusters from sparse or noisy observations.

References

Ester, M., Kriegel, H.-P., Sander, J., Xu, X. (1996). A Density-Based Algorithm for Discovering Clusters in Large Spatial Databases with Noise. Zhao, Y., & Karypis, G. (2001). Criterion functions for document clustering.

Examples

Run this code
# setup clustering
model <- cluster_dbscan(minPts = 3)

#load dataset
data(iris)

# build model
model <- fit(model, iris[,1:4])
clu <- cluster(model, iris[,1:4])
table(clu)

# evaluate model using external metric
eval <- evaluate(model, clu, iris$Species)
eval

Run the code above in your browser using DataLab