Spaces:
Sleeping
Sleeping
| import numpy as np | |
| class MonitoringEngine: | |
| def detect_drift(self, train_stats, new_data_stats, threshold=0.2): | |
| drift_flags = {} | |
| for feature in train_stats: | |
| if abs(train_stats[feature] - new_data_stats.get(feature, train_stats[feature])) > threshold: | |
| drift_flags[feature] = True | |
| return drift_flags | |