Distribution Shift Detection#
The shift module provides methods for detecting and quantifying distribution shifts between training and deployment data.
Base Class#
Abstract base class for distribution shift detection methods. |
Shift Detectors#
|
Kernel Maximum Mean Discrepancy with Gaussian (RBF) kernel. |
Energy distance – Szekely & Rizzo, 2013. |
|
One-dimensional Kolmogorov–Smirnov test (per feature, max statistic). |
|
|
Train a logistic regression to separate reference and test. |
alias of |
|
|
Black-Box Shift Detection for label shift. |
|
Importance weighting for covariate shift adaptation. |
Metrics#
|
Szekely–Rizzo energy distance, O(n²) naive implementation. |
|
Total variation between discrete distributions p and q. |
|
Classic tabular PSI used in credit scoring. |
|
Wasserstein distance (Earth Mover's Distance) between two empirical distributions. |
|
Sliced Wasserstein distance between two empirical distributions. |
Visualization#
|
Overlay 1-D histograms for a handful of features. |
|
Visualize reference and test embeddings in 2D space. |
|
Compare model confidence distributions between reference and test data. |
|
Plot shift scores against a severity measure (e.g., rotation degrees, time). |
|
Bar chart of per-feature KS statistics showing which features shifted most. |