eqdisco.mlops.DriftMonitor#

class eqdisco.mlops.DriftMonitor(equation, X_ref, y_ref=None, psi_warning=0.1, psi_retrain=0.25, domain_tolerance=0.05, ph_delta=0.1, ph_lambda=10.0, sample_size_correction=True)[source]#

Bases: object

Monitor the inputs and residuals of a deployed equation.

Parameters:
equationEquation
X_ref, y_refarray_like

Reference (training) data.

psi_warning, psi_retrainfloat

PSI thresholds of a warning and of a retraining recommendation.

sample_size_correctionbool, default=True

Raise each PSI threshold to the 95 % (warning) or 99 % (retraining) point of the PSI of two same-distribution samples of the actual sizes (psi_critical_value()), so that small batches do not raise false alarms.

domain_tolerancefloat

Share of new samples allowed outside the training box before a warning.

ph_delta, ph_lambdafloat

Page–Hinkley parameters, relative to the reference residual standard deviation: tolerated drift magnitude and detection threshold.

check(X_new, y_new=None)[source]#

Drift report of a batch of new data.

Returns a dictionary with per-variable PSI and Kolmogorov–Smirnov p-values, the share of samples outside the training box, residual statistics and the Page–Hinkley alarm (if y_new is given), and status in {"ok", "warning", "retrain"} with the reasons.

page_hinkley(residuals)[source]#

Page–Hinkley test for an increase of the absolute standardized residual; returns (alarm, index).

Examples using eqdisco.mlops.DriftMonitor#

Registry, model card and drift monitoring

Registry, model card and drift monitoring