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 XPWhat is the critical reason for fitting transformers (e.g. StandardScaler) strictly on the Training set and never on the full dataset?