Python 中的机器学习监控
Maciej Balawejder
Data Scientist


# 初始化算法
cbpe = nannyml.CBPE(
problem_type='classification_binary',
y_pred_proba='predicted_probability',
y_pred='prediction',
y_true='employed',
metrics=['roc_auc'],
chunk_period='m',
# chunk_size = 5000,
# chunk_number = 10
)
标准差阈值
# 标准差阈值
stdt = StandardDeviationThreshold(
std_lower_multiplier=3,
std_upper_multiplier=3
)
常量阈值
# 常量阈值
ct = ConstantThreshold(
lower=0.85,
upper=0.95
)
# 导入阈值方法(上一页)
from nannyml.thresholds import ConstantThreshold, StandardDeviationThreshold
# 将阈值传入 CBPE 算法
estimator = nannyml.CBPE(...
metrics = ['roc_auc', 'accuracy'],
thresholds={'roc_auc': ct, 'accuracy' : stdt}
)

filtered_results = results.filter(period='analysis')
按指标
filtered_results = results.filter(metrics=['mae'])
同时按二者
filtered_results = results.filter(period='analysis', metrics=['mae'])
# 导出为 DataFrame 格式
results.filter(period='analysis').to_df()

Python 中的机器学习监控