飯店預訂資料集的漂移
在前一章中,你計算了用於預測取消預訂的模型之商業價值與 ROC AUC 表現。你在產生的圖中注意到幾個警示,因此需要進一步調查分析資料中是否出現漂移。
在這個練習中,你會初始化多變量漂移偵測方法,並把其結果與上一章計算的模型表現結果做比較。
StandardDeviationThreshold 已匯入,perf_results 變數中已包含商業價值與 ROC AUC 的結果,且 feature_column_names 也已定義。
本練習屬於課程
在 Python 中監控 Machine Learning
練習說明
- 初始化
StandardDeviationThreshold方法,並將std_lower_multiplier設為2、std_upper_multiplier參數設為1。 - 加入以下特徵名稱:
country、lead_time、parking_spaces、hotel,並保留其順序。 - 將先前定義的門檻與特徵名稱傳入
DataReconstructionDriftCalculator。 - 顯示同時包含多變量漂移偵測結果(
mv_results)與模型表現結果(perf_results)的比較圖。
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
# Create standard deviation thresholds
stdt = StandardDeviationThreshold(____=____, ____=____)
# Define feature columns
feature_column_names = [____, ____, ____, ____]
# Intialize, fit, and show results of multivariate drift calculator
mv_calc = nannyml.DataReconstructionDriftCalculator(
column_names=____,
threshold = ____,
timestamp_column_name='timestamp',
chunk_period='m')
mv_calc.fit(reference)
mv_results = mv_calc.calculate(analysis)
mv_results.filter(period='analysis').____(____).plot().show()