MLOps & Model Monitoring
Version Control, MLflow, and Data Drift
Building a model is only 20% of the work. Deploying, monitoring, and maintaining it in production is the other 80%. **MLOps** (Machine Learning Operations) brings DevOps principles to ML. For **Visa**, a fraud model that was 98% accurate last month might drop to 85% this month due to **Data Drift**—fraudsters change tactics.
In this chapter, we explore **Model Versioning** with MLflow, **Data Drift Detection**, and **CI/CD Pipelines** for automated model retraining and deployment.
Model Versioning with MLflow
**MLflow** tracks every experiment: which dataset was used, which hyperparameters were set, and what metrics were achieved. For **Walmart**, this means they can compare last week's demand model (v2.3) with this week's retrained version (v2.4) and decide which one to promote to production.
Data Drift Detection
**Data Drift** occurs when the real-world data distribution changes from what the model was trained on. For **Visa**, this happens when fraudsters adopt new attack vectors. A model trained on "large single purchases" might miss "thousands of micro-transactions." Drift detection compares incoming data distributions against the training baseline.
CI/CD for Machine Learning
**CI/CD (Continuous Integration / Continuous Deployment)** automates the testing and deployment of ML models. For **Walmart**, when a data scientist pushes a new model version, the pipeline automatically validates it against a test set, checks for performance regression, and deploys it if it passes—all without manual intervention.
Practice Questions
Question 1
What is 'Data Drift' and why is it dangerous for Visa's fraud model?
Question 2
Why is MLflow valuable for Walmart's data science team?