Expand description
Data drift and distribution shift detection
This module provides multivariate drift detection for monitoring feature distributions over time between a reference dataset and a current (production) dataset.
§Methods
| Method | Description |
|---|---|
DriftMethod::KolmogorovSmirnov | 2-sample KS test per feature with asymptotic p-value |
DriftMethod::PopulationStabilityIndex | Binning-based PSI score |
DriftMethod::Wasserstein | W1 (Earth mover’s) distance per feature |
DriftMethod::MaximumMeanDiscrepancy | MMD² with RBF kernel (multivariate) |
§Example
use scirs2_transform::drift::{DriftDetector, DriftDetectorConfig, DriftMethod};
use scirs2_core::ndarray::Array2;
let reference = Array2::<f64>::zeros((100, 3));
let config = DriftDetectorConfig::default();
let detector = DriftDetector::fit(&reference, config);
let current = Array2::<f64>::zeros((80, 3));
let report = detector.detect(¤t).expect("detection should succeed");
assert!(!report.drifted, "identical distributions should not drift");Structs§
- Drift
Detector - Multivariate drift detector that compares a reference distribution against a current (test) distribution feature by feature.
- Drift
Detector Config - Configuration for a
DriftDetector. - Drift
Report - Report produced by
DriftDetector::detect.
Enums§
- Drift
Method - Method used for drift detection.
Functions§
- ks_test
- Compute the 2-sample KS statistic and asymptotic p-value for two 1D samples.
- mmd_rbf
- Compute MMD² with RBF kernel for two 1D sample arrays.
- psi
- Compute PSI between a reference and current 1D distribution.
- wasserstein_
distance_ 1d - Compute the W1 (Wasserstein-1) distance between two 1D empirical distributions.