Model Validation Framework
Model testing, data drift detection, performance monitoring, and validation gates for CI/CD.
📄 Product Preview
Try the interactive reader and demo tools below, or get the full product with all content unlocked.
📖 Interactive Reader (Free Preview) ⚙ Try Demo Tools 📦 Download Free Sample📁 File Structure 18 files
📖 Documentation Preview README excerpt
Model Validation Framework
A dependency-light framework for validating machine-learning models before
you promote them to production and while they run there. It bundles data &
concept drift detection, baseline performance monitoring, behavioral testing,
and a configurable pass/fail validation gate you can wire straight into CI/CD.
Everything is implemented in pure NumPy — the SciPy-grade statistics
(Kolmogorov-Smirnov p-values, chi-square survival function, Population Stability
Index, rank-based ROC AUC) are written from scratch, so the framework runs
anywhere NumPy is installed and has zero heavy dependencies. If you already use
scikit-learn or SciPy, the framework plugs into them cleanly (feed your own
metric dicts or model callables into the same checks).
Features
- Data drift detection — per-feature PSI + Kolmogorov-Smirnov (numeric) and
chi-square + categorical PSI (categorical), combining effect size and
significance to avoid large-sample false alarms. Returns a structured
DriftReport.
- Performance monitoring — compare a current metric snapshot to a trusted
baseline; detect relative degradation and absolute-floor violations.
- Behavioral tests — model-agnostic invariance, directional-expectation, and
minimum-functionality tests (CheckList-style) that catch logic bugs aggregate
metrics hide.
- Validation gate — a
ValidationSuiteaggregates any mix of checks into a
single PASS / WARN / FAIL decision, with a configurable fail threshold.
- Markdown & JSON reports — drop a readable report into a PR comment or a CI
log; emit JSON for dashboards and audit trails.
- Typed, versionable thresholds — all policy lives in dataclasses
(ValidationConfig) you can serialise to JSON and commit next to the model.
- NumPy metric functions —
accuracy,precision,recall,f1,
roc_auc, rmse, mae, r2 with no scikit-learn requirement.
Requirements
- Python 3.9+
- NumPy (the only hard dependency)
- Optional: pandas (drift detection accepts DataFrames as well as dict-of-
columns), scikit-learn / SciPy (interop — pass their metrics/models in)
pip install numpy # required
pip install pandas # optional, for DataFrame inputs
Quick Start
The package lives under src/. Run the examples straight from the product root
(they add src/ to the path for you):
# 1. Standalone drift report on synthetic reference vs production data
python examples/drift_check.py
# 2. Full validation suite on a trained (NumPy) classifier
python examples/validate_model.py
To use it in your own project, put src/ on your PYTHONPATH (or copy the
... continues with setup instructions, usage examples, and more.