monitor

package
v1.36.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 29, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Experimental — this package is not yet wired into the main framework.

Package monitor provides drift detection for deployed models using statistical tests (Page-Hinkley, ADWIN) to detect performance degradation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ADWIN

type ADWIN struct {
	// contains filtered or unexported fields
}

ADWIN (ADaptive WINdowing) detects distributional shifts by maintaining a variable-length window of observations and testing whether any two sub-windows have statistically different means.

When a change is detected, the older sub-window is dropped, allowing the detector to adapt to the new distribution.

func NewADWIN

func NewADWIN(cfg ADWINConfig) *ADWIN

NewADWIN creates an ADWIN detector with the given config.

func (*ADWIN) Observe

func (a *ADWIN) Observe(value float64) bool

Observe ingests a value and returns true if drift is detected. When drift is detected, the older portion of the window is dropped.

func (*ADWIN) Reset

func (a *ADWIN) Reset()

Reset clears all internal state.

type ADWINConfig

type ADWINConfig struct {
	// Confidence controls the sensitivity of the change detector.
	// Lower values make it more sensitive. Typical range is 0.001 to 0.01.
	// Defaults to 0.002 if zero.
	Confidence float64
}

ADWINConfig holds parameters for the ADWIN detector.

type DriftDetector

type DriftDetector interface {
	// Observe ingests the next value in the stream.
	// It returns true when drift is detected.
	Observe(value float64) bool
}

DriftDetector observes a stream of scalar values and returns true when it detects a statistically significant distributional shift.

type PageHinkley

type PageHinkley struct {
	// contains filtered or unexported fields
}

PageHinkley implements the Page-Hinkley test for detecting changes in the mean of a sequential stream of values.

The test maintains a cumulative sum of deviations from the running mean, adjusted by a tolerance parameter delta. Drift is detected when the difference between the maximum cumulative sum and the current cumulative sum exceeds a threshold lambda.

func NewPageHinkley

func NewPageHinkley(cfg PageHinkleyConfig) *PageHinkley

NewPageHinkley creates a Page-Hinkley detector with the given config.

func (*PageHinkley) Observe

func (ph *PageHinkley) Observe(value float64) bool

Observe ingests a value and returns true if drift is detected.

func (*PageHinkley) Reset

func (ph *PageHinkley) Reset()

Reset clears all internal state so the detector can be reused.

type PageHinkleyConfig

type PageHinkleyConfig struct {
	// Delta is the magnitude of allowed changes (tolerance).
	// A smaller delta makes the test more sensitive.
	// Defaults to 0.005 if zero.
	Delta float64

	// Lambda is the detection threshold. When the test statistic
	// exceeds Lambda, drift is signalled.
	// Defaults to 50 if zero.
	Lambda float64
}

PageHinkleyConfig holds parameters for the Page-Hinkley test.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL