mhahsler/dbscan

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

What it solves

This package provides a fast C++ implementation of density-based clustering and outlier detection algorithms, specifically designed for spatial data. It allows users to identify clusters of arbitrary shapes and detect noise points (outliers) in datasets where traditional distance-based clustering might fail.

How it works

The library implements several algorithms from the DBSCAN family, including DBSCAN, HDBSCAN, OPTICS, and SNN. To achieve high performance, it utilizes the kd-tree data structure (via the ANN library) for fast k-nearest neighbor and fixed-radius nearest-neighbor searches, making it typically faster than native R or Python scikit-learn implementations for Euclidean distance.

Who it’s for

It is primarily for data scientists and researchers using R (though it can be accessed via Python through rpy2) who need to perform density-based clustering or outlier detection on spatial or numeric datasets.

Highlights

  • Comprehensive Algorithm Suite: Includes DBSCAN, HDBSCAN, OPTICS, FOSC, Jarvis-Patrick, and SNN clustering.
  • Outlier Detection: Features LOF (Local Outlier Factor) and GLOSH algorithms.
  • Cluster Evaluation: Implements DBCV (Density-Based Clustering Validation).
  • Tidyverse Integration: Provides tidy(), augment(), and glance() methods for seamless use with ggplot2 and tidymodels.
  • High Performance: C++ backend with kd-tree optimization for fast nearest-neighbor searches.

Related

  • Project
  • Project
  • Project
  • Project
  • Project