DDMDriftDetector<T>

Models & Types · AiDotNet.DriftDetection

Drift Detection Method (DDM) for concept drift detection based on error rate monitoring.

Inheritance: DriftDetectorBase<T> → DDMDriftDetector<T>

For Beginners

DDM monitors the error rate of a classifier over time. When the error rate increases significantly beyond what was observed during a stable period, drift is detected. DDM is simple, fast, and effective for detecting sudden drift.

How It Works

How it works:

  • Track the error rate p and its standard deviation s = sqrt(p(1-p)/n)
  • Remember the minimum observed value of p + s (the baseline)
  • Warning level: p + s > p_min + s_min + warning_threshold × s_min
  • Drift level: p + s > p_min + s_min + drift_threshold × s_min

Key insight: For a stable distribution, p + s should remain relatively constant. A significant increase indicates the underlying distribution has changed.

Parameters:

  • warningThreshold: Number of standard deviations for warning (default: 2)
  • driftThreshold: Number of standard deviations for drift (default: 3)

Advantages:

  • Simple and computationally efficient
  • Two-stage detection (warning before drift)
  • Well-suited for sudden drift

Limitations:

  • Assumes binary errors (0 or 1)
  • May be slow to detect gradual drift
  • Can miss drift if error rate decreases

Reference: Gama et al. (2004). “Learning with Drift Detection”

Constructors

Constructor Summary
DDMDriftDetector(double warningThreshold, double driftThreshold, int minimumObservations) Creates a new DDM drift detector.

Properties

Property Summary
bool IsInWarning { get; set; } Gets whether the detector is in the warning zone.
double ErrorRate { get; } Gets the current error rate.
double MinimumPPlusS { get; } Gets the minimum p + s observed.
int SamplesInWarning { get; } Gets the number of samples since entering warning zone.

Methods

Method Summary
bool AddObservation(T value) Adds a new observation (typically a prediction error: 1 for wrong, 0 for correct).
void Reset() Resets the detector to its initial state.