多变量漂移检测

Python 中的机器学习监控

Hakim Elakhrass

CEO and co-founder

什么是多变量漂移检测?

  • 根因分析的第一步
  • 输出为所有特征的单一数值
  • 可检测细微的数据变化

图中展示了监控流程及多变量漂移检测在其中的位置。

Python 中的机器学习监控

工作原理

  1. 使用 PCA 压缩数据
  2. 使用逆 PCA 解压回原始形状
  3. 计算重构误差;误差上升表示数据发生漂移

图中展示了多变量漂移检测的工作原理。

Python 中的机器学习监控

代码实现

# Initialize multivariate drift detection calculator
mv_calc = nannyml.DataReconstructionDriftCalculator(
    column_names=features_column_names,
    timestamp_column_name='timestamp',
    chunk_period='m'
    )
# Fit and calculate the results
mv_calc.fit(reference)
mv_results = mv_calc.calculate(analysis)
Python 中的机器学习监控

绘制结果

mv_figure = mv_results.filter(period='analysis').plot()
mv_figure.show()

图中显示了随时间变化的重构误差曲线。

Python 中的机器学习监控

多变量漂移 vs 实际性能

figure = mv_results.filter(period='analysis').compare(perf_results).plot()
figure.show()

图中比较了实际性能与重构误差的曲线。

Python 中的机器学习监控

让我们来练习!

Python 中的机器学习监控

Preparing Video For Download...