LDCOFDetector<T>

Models & Types · AiDotNet.AnomalyDetection.DistanceBased

Detects anomalies using LDCOF (Local Density Cluster-Based Outlier Factor).

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

Implements: IGeneratedParameterRegistrar<T>

For Beginners

LDCOF combines clustering with density-based outlier detection. It first clusters the data, then computes outlier scores based on how a point’s density compares to its cluster’s density. Points in sparse regions of dense clusters are flagged.

How It Works

The algorithm works by:

  1. Cluster the data using k-means
  2. Compute local density for each point
  3. Compare point density to cluster average density
  4. Large deviations indicate outliers

When to use:

  • When data has natural cluster structure
  • For detecting local outliers within clusters
  • When global methods miss cluster-specific anomalies

Industry Standard Defaults:

  • Number of clusters: 8
  • Number of neighbors (k): 10
  • Contamination: 0.1 (10%)

Reference: Amer, M., Goldstein, M. (2012). “Nearest-Neighbor and Clustering based Anomaly Detection Algorithms for RapidMiner.” Workshop on Open Source Data Mining Software.

Constructors

Constructor Summary
LDCOFDetector(int numClusters, int numNeighbors, double contamination, int randomSeed) Creates a new LDCOF anomaly detector.

Properties

Property Summary
int NumClusters { get; } Gets the number of clusters.
int NumNeighbors { get; } Gets the number of neighbors for density estimation.

Methods

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