mhahsler/dbscan

Density Based Clustering of Applications with Noise (DBSCAN) and Related Algorithms - R package

What it solves

Clustering data when clusters can be irregular in shape and contain noise is a common problem. Traditional methods like k-means assume spherical clusters and are sensitive to outliers. This package brings density-based clustering algorithms to R, which can find clusters of any shape and automatically identify noise points, while also supporting outlier detection and cluster evaluation.

How it works

The package provides C++ implementations of several density-based algorithms, called through an R interface. It uses k-d trees to speed up nearest-neighbor searches, making it faster than base R code and even than some other implementations like scikit-learn. The main included methods are DBSCAN, HDBSCAN, OPTICS, Jarvis-Patrick, and SNN clustering. It also includes outlier detection via LOF and GLOSH, and cluster validation using DBCV.

Who it's for

Researchers and data analysts working in R who need to cluster spatial or high-dimensional data, especially when clusters are not spherical or when the data contains noise. It is also useful for anyone needing fast outlier detection from density-based hierarchies.

Highlights

  • Fast C++ implementations accelerated with k-d trees
  • Includes DBSCAN, HDBSCAN, OPTICS, and other density-based algorithms
  • Built-in outlier detection (LOF, GLOSH) and cluster validation (DBCV)
  • Widely used by many other R packages, as listed in the README

Related

  • Project
  • Project
  • Project
  • Project
  • Project