⭐ Star
0%
MODULE 12 ⏱️ 15-22 MIN READ

MLOps Pipelines, Model Drift & Production Serving

Deploy robust scikit-learn ColumnTransformer pipelines, track experiments with MLflow, and detect data drift using Kolmogorov-Smirnov tests.

1. Production Scikit-Learn Pipelines

Prevent data leakage between train and test splits by encapsulating imputers, scalers, and estimators into an atomic \(\text{Pipeline}\):

\[ \text{Pipeline}\big([(\text{'impute'}, \text{SimpleImputer}()), (\text{'scale'}, \text{StandardScaler}()), (\text{'model'}, \text{XGBClassifier}())]\big) \]

2. Detecting Data Drift & Concept Drift

  • Data Drift (Covariate Shift): Input distribution \(P(X)\) shifts over time. Detected via the **Kolmogorov-Smirnov (KS) test** or Population Stability Index (PSI).
  • Concept Drift: The underlying relationship \(P(Y \mid X)\) changes (e.g. consumer behavior shift post-event).

🎯 Module Mastery Certification Quiz

+100 XP
What is the critical reason for fitting transformers (e.g. StandardScaler) strictly on the Training set and never on the full dataset?
To prevent Data Leakage, ensuring test data statistics (mean, variance) do not contaminate the training process.
Because test datasets cannot be processed by Python.
To speed up execution by 2x.
Because StandardScaler crashes on test splits.