An end-to-end machine learning engineering project focused on monitoring model performance, identifying data drift, and building reproducible retraining pipelines.
The ModelOps dashboard provides an interactive interface for monitoring model performance, detecting data drift, and managing the model lifecycle.
ModelOps is a self-service machine-learning operations platform supporting model registration, inference, drift monitoring, performance evaluation, guarded retraining and version management.
The interactive demonstration is available without registration and uses reproducible synthetic data.
Registered users can manage their own model workspaces, upload compatible classifiers, generate predictions, evaluate challengers and download eligible model versions.
Public model-upload access is currently restricted while additional security controls are implemented.
- Reproducible model training using synthetic customer data
- Data drift detection using PSI and KS statistical tests
- Model performance monitoring and evaluation
- Champion-challenger retraining with guarded promotion
- Experiment tracking and candidate registration using MLflow
- REST API development and model serving using FastAPI
- Interactive monitoring dashboard using Streamlit
- Automated testing and CI using pytest and GitHub Actions
ModelOps compares historical model-development data with incoming observations to identify changes in input-feature distributions.
The monitoring engine implements:
- Population Stability Index (PSI)
- Reference-based quantile binning
- KS distribution comparison for numeric features
- Categorical distribution comparison
- Configurable drift thresholds
- Feature validation and error handling
- JSON and Markdown monitoring reports
python -m src.modelops.monitorRequires Python 3.12.
python3.12 -m venv .venv
source .venv/bin/activate
python -m pip install -r requirements.txt
python -m src.modelops.generate_data
python -m src.modelops.train
python -m pytest -qThe dataset is entirely synthetic and is intended for demonstrating machine learning monitoring workflows.
It must not be interpreted as evidence of real-world customer churn behaviour.
python -m src.modelops.performancereports/performance_report.mdreports/performance_report.jsonreports/performance_history.jsonl
The demonstration uses fully labeled synthetic cohorts. The initial baseline is derived from a held-out historical dataset.
Changes in metrics may reflect changes in outcome prevalence, the incoming population, or model behaviour. A drift alert alone does not justify automatic model replacement.
ModelOps supports retraining a customer churn classifier using newly available labeled customer observations.
The system trains a challenger model and compares it with the active champion model before permitting promotion.
- Load historical training data and newly labeled data.
- Recreate the historical training and holdout partitions.
- Separate incoming data into training and evaluation sets.
- Train a challenger using historical and incoming training data.
- Evaluate the champion and challenger on identical holdouts.
- Apply configurable performance acceptance checks.
- Archive the previous champion before explicit promotion.
- Generate evaluation reports and a retraining audit history.
python -m src.modelops.retrainA dry run never replaces the active model.
python -m src.modelops.retrain --promotePromotion is permitted only when all acceptance checks pass.
reports/retraining_decision.mdreports/retraining_decision.jsonreports/retraining_history.jsonl
artifacts/churn_model.joblib— active championartifacts/candidates/— trained challengerartifacts/archive/— previous champion versions
ModelOps integrates MLflow to track and compare champion and challenger machine-learning models.
The experiment-tracking workflow records:
- Historical and incoming holdout metrics
- Training and evaluation cohort sizes
- Model training configuration
- Source dataset fingerprints
- Champion and challenger model artifacts
- Retraining decisions and evaluation reports
- Registered challenger model versions
python -m src.modelops.track_experimentpython -m src.modelops.track_experiment --register-candidateCandidate registration does not promote or deploy a model.
mlflow server \
--backend-store-uri sqlite:///mlflow.db \
--default-artifact-root "$PWD/mlruns" \
--host 127.0.0.1 \
--port 5000Open http://127.0.0.1:5000 and select
the modelops-churn-retraining experiment.
The local MLflow backend uses SQLite for experiment metadata and local storage for model artifacts.
Candidate model versions are registered under
modelops-churn-candidates.
Registration is separate from model promotion. The current inference champion remains managed by the guarded local promotion workflow.
ModelOps provides a FastAPI inference service that serves the active, locally promoted churn classifier.
The service supports:
- Single-customer churn predictions
- Batch predictions for up to 100 customers
- Pydantic input validation
- Model availability and health checks
- Model artifact SHA-256 fingerprints
- Token-protected model reloading
- Safe in-memory model replacement
- Automated API tests
Activate the Python virtual environment.
source .venv/bin/activateLoad a locally configured admin token if model reloading is required.
source .env.localRun the development server:
python -m uvicorn src.modelops.api:app \
--host 127.0.0.1 \
--port 8000 \
--reloadThe interactive API documentation is available at:
| Method | Route | Purpose |
|---|---|---|
| GET | /health | Model availability |
| GET | /model | Active model metadata |
| POST | /predict | Single-customer prediction |
| POST | /predict/batch | Batch prediction |
| POST | /admin/reload | Reload the active model |
The inference service loads the model from
artifacts/churn_model.joblib.
Retraining a challenger or registering a model version in MLflow does not automatically change the model served by the API.
A model must first be explicitly promoted through the guarded retraining workflow.
The running inference service can then reload the updated champion using the protected reload endpoint.
ModelOps includes a Streamlit monitoring workbench that combines model observability and inference.
- System overview and active champion identification
- PSI-based feature drift visualisation
- Historical-versus-incoming model performance
- Retraining decision and acceptance-check review
- Interactive customer churn predictions
- Connection to the FastAPI inference service
Start FastAPI in one terminal:
python -m uvicorn src.modelops.api:app \
--host 127.0.0.1 --port 8000
Start Streamlit in another:
python -m streamlit run dashboard/app.py \
--server.address 127.0.0.1 \
--server.port 8501
Open http://127.0.0.1:8501.
The dashboard reads locally generated monitoring reports and queries the active champion through the FastAPI API.
It does not directly promote or replace models.
The sample application uses synthetic customer data and is intended for engineering demonstration.
The platform separates three main responsibilities:
- Model development and monitoring: Python pipelines implement dataset generation, model training, feature drift analysis, delayed-label performance evaluation, and guarded retraining.
- Model serving: FastAPI serves a reproducibly trained baseline classifier through validated prediction endpoints hosted on Render.
- Monitoring interface: Streamlit Community Cloud displays example monitoring reports, model evaluations, retraining decisions, and live predictions.
GitHub Actions automatically validates the project on Python 3.12, runs the automated test suite, reproduces the baseline model, and exercises the monitoring and inference pipelines.
MLflow provides local experiment comparison and candidate model registration. The MLflow tracking database and local model registry are not publicly hosted.
The public application uses synthetic customer data and is intended solely for engineering demonstration. Monitoring reports are offline-generated snapshots, not real-time production telemetry.
The public inference backend serves a reproducibly trained baseline model. Local model promotions and MLflow registrations do not automatically update the deployed model.
Free hosting services may experience cold starts and inactivity-related suspension.
The FastAPI service can run locally, and a separate public deployment serves a reproducibly trained baseline model on Render.
Local model promotions and MLflow registrations do not automatically update the public deployment.
The system uses synthetic customer data and is intended for engineering demonstrations, not real-world decisions.
The admin reload endpoint uses a shared token, and additional authentication, auditing, rate limiting, monitoring, and deployment safeguards would be required for public production use.
The service is designed for a single local worker. Multiple worker processes would require coordinated model-version management.
