當標籤可用時

在 Python 中監控 Machine Learning

Maciej Balawejder

Data Scientist

預估 vs 實現效能

預估效能:

  • 衡量模型在 {{1}} 的預期表現

  • 估計器(如 CBPE、DLE)決定

  • 在沒有真實標籤時進行預估

實現效能:

  • 代表實際量測的表現
  • 由效能計算器決定
  • 在有真實標籤時計算
在 Python 中監控 Machine Learning

延遲的真實標籤

此圖呈現時間軸,每週有三個點。每逢星期一評估模型的實現效能,週一之間則用 CBPE 估計效能。

在 Python 中監控 Machine Learning

效能計算器

# Intialize the calculator
calc = nannyml.PerformanceCalculator(
    y_pred_proba='y_pred_proba',
    y_pred='y_pred',
    y_true='arrived',
    timestamp_column_name='timestamp',
    problem_type='classification_binary',
    chunk_period='d',
    metrics=['roc_auc', 'accuracy'],
    )
# Fit the calculator
calc.fit(reference)
realized_results = calc.calculate(analysis)
在 Python 中監控 Machine Learning

繪製結果

# Show realized performance plot
results.plot().show()

此圖為實現 ROC AUC 圖,顯示 2019 年 4 月到 2019 年 8 月的表現下滑。

在 Python 中監控 Machine Learning

實現與預估效能

# Estimate and calculate results
estimated_results = estimator.estimate(analysis)
realized_results = calculator.calculate(analysis)


# Show comparison plot realized_results.compare(estimated_results).plot().show()
在 Python 中監控 Machine Learning

實現與預估效能

此圖比較 ROC AUC 指標的實現與預估效能。

在 Python 中監控 Machine Learning

一起來練習吧!

在 Python 中監控 Machine Learning

Preparing Video For Download...