DBSCANDetector<T>

Models & Types · AiDotNet.AnomalyDetection.ClusterBased

Detects anomalies using DBSCAN (Density-Based Spatial Clustering of Applications with Noise).

Inheritance: ModelBase<T, Matrix<T>, Vector<T>> → AnomalyDetectorBase<T> → DBSCANDetector<T>

Implements: IGeneratedParameterRegistrar<T>

For Beginners

DBSCAN groups together points that are closely packed and marks points in low-density regions as outliers (noise).

How It Works

The algorithm works by:

  1. For each point, find all neighbors within epsilon distance
  2. If a point has at least minPts neighbors, it’s a core point
  3. Expand clusters from core points
  4. Points not belonging to any cluster are noise (anomalies)

When to use:

  • When anomalies are in low-density regions
  • When clusters have arbitrary shapes
  • No need to specify number of clusters in advance

Industry Standard Defaults:

  • Epsilon: estimated from data (k-distance method)
  • MinPts: 2 * dimensions
  • Contamination: 0.1 (10%)

Reference: Ester, M., et al. (1996). “A Density-Based Algorithm for Discovering Clusters.” KDD.

Constructors

Constructor Summary
DBSCANDetector(double? epsilon, int? minPts, double contamination, int randomSeed) Creates a new DBSCAN anomaly detector.

Properties

Property Summary
T Epsilon { get; } Gets the epsilon (neighborhood radius) parameter.
int MinPts { get; } Gets the minimum points parameter.

Methods

Method Summary
Vector<T> ScoreAnomalies(Matrix<T> X)
void Fit(Matrix<T> X)