PageHinkleyDriftDetector<T>

Models & Types · AiDotNet.DriftDetection

Page-Hinkley test for concept drift detection using cumulative sum analysis.

Inheritance: DriftDetectorBase<T> → PageHinkleyDriftDetector<T>

For Beginners

The Page-Hinkley test is a sequential analysis technique that monitors a cumulative sum of deviations from the mean. When the cumulative sum exceeds a threshold, drift is detected. It’s particularly good at detecting changes in the mean of a stream.

How It Works

How it works:

  • Calculate the running mean x̄ of observations
  • For each new value x, update cumulative sum: m = m + (x - x̄ - δ)
  • Track the minimum value M of the cumulative sum
  • When (m - M) > λ, drift is detected

Parameters:

  • delta (δ): Magnitude of allowed changes - helps filter noise (default: 0.005)
  • lambda (λ): Detection threshold - higher = less sensitive (default: 50)

Key insight: The cumulative sum tracks deviations from expected behavior. Normal fluctuations cancel out over time, but a true change causes monotonic increase.

Advantages:

  • Based on solid statistical foundation (sequential analysis)
  • Low computational cost
  • Works well for detecting changes in mean
  • Can be adapted for two-sided detection (increases and decreases)

Limitations:

  • Requires tuning delta and lambda parameters
  • Primarily detects shifts in mean, not other distribution changes

Reference: Page, E. S. (1954). “Continuous Inspection Schemes”

Constructors

Constructor Summary
PageHinkleyDriftDetector(double delta, double lambda, double warningFraction, bool twoSided, int minimumObservations) Creates a new Page-Hinkley drift detector.

Properties

Property Summary
bool IsInWarning { get; set; } Gets whether the detector is in warning zone.
bool IsTwoSided { get; } Gets whether two-sided detection is enabled.
double Delta { get; } Gets the magnitude threshold (delta).
double PageHinkleyStatisticDown { get; } Gets the current Page-Hinkley statistic for mean decrease detection (if two-sided).
double PageHinkleyStatisticUp { get; } Gets the current Page-Hinkley statistic for mean increase detection.
double Threshold { get; } Gets the detection threshold (lambda).

Methods

Method Summary
bool AddObservation(T value) Adds a new observation to the detector.
void Reset() Resets the detector to its initial state.