評估整體模型(ensemble)
到目前為止都很好。不過,實際上有多好呢?透過交叉驗證樣本外的 AUC,展現你的模型評估能力!
boost_spec 的規格與 customers_train 的 tibble 仍已載入。
本練習屬於課程
R 的樹狀模型機器學習
練習說明
- 建立訓練資料的 5 個交叉驗證(CV)摺疊,並將其儲存為
folds。 - 使用你的規格、所有預測變數與 AUC 指標,針對每個摺疊擬合並評估一個預測
still_customer的模型。 - 彙整
cv_results的評估指標,並檢查 AUC 的平均值。
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
set.seed(99)
# Create CV folds
folds <- ___
# Fit and evaluate models for all folds
cv_results <- fit_resamples(___,
___,
resamples = ___,
___)
# Collect cross-validated metrics
___