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.

PythonRuns entirely in your browser — nothing is sent to a server.

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.

PythonRuns entirely in your browser — nothing is sent to a server.

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.

PythonRuns entirely in your browser — nothing is sent to a server.

Practice Questions

Question 1

What is 'Data Drift' and why is it dangerous for Visa's fraud model?

  • It means the database is moving to a new server
  • It means the real-world data distribution has changed from what the model was trained on, causing accuracy to degrade silently
  • It means the model is getting faster
  • It only happens with linear models

Question 2

Why is MLflow valuable for Walmart's data science team?

  • It makes Python faster
  • It tracks every experiment's parameters, datasets, and metrics, enabling reproducibility and informed decisions about which model version to promote
  • It replaces the need for training data
  • It only works with XGBoost