Lesson 7 of 11 · 2 min
Model Drift Monitoring
| Type | What Changes | Example |
|---|---|---|
| Data drift | Input feature distribution shifts | Hospital acquires new scanner |
| Concept drift | Relationship between X and y changes | User behaviour changed post-COVID |
| Label drift | Target distribution shifts | More cancers detected over time |
from scipy.stats import ks_2samp
def check_data_drift(ref_data, new_data, feature_name, threshold=0.05):
stat, p_value = ks_2samp(ref_data, new_data)
drift_detected = p_value < threshold
return {'feature': feature_name, 'p_value': p_value, 'drift': drift_detected}
