比較 AUC
比較不同模型是模型挑選的核心。在最後兩個練習中,你會對本課程涵蓋的所有模型類型進行比較:決策樹、袋裝樹(bagging)、隨機森林,以及梯度提升。
所有模型都已完成調參,並在同一個訓練集 customers_train 上訓練,接著對 customers_test 資料集做出預測。結果是數值機率,已在你的工作階段中以 preds_combined 提供:
tibble [1,011 × 5]
$ preds_tree : 0.144 0.441 ...
$ preds_bagging : 0.115 0.326 ...
$ preds_forest : 0 0 0 0.286 ...
$ preds_boosting: 0.136 0.149 ...
$ still_customer: "no","no", ...
本練習屬於課程
R 的樹狀模型機器學習
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
# Calculate the AUC for each model
auc_tree <- ___(preds_combined, truth = ___, estimate = ___)
auc_bagged <- ___(preds_combined, truth = ___, estimate = ___)
auc_forest <- ___(preds_combined, truth = ___, estimate = ___)
auc_boost <- ___(preds_combined, truth = ___, estimate = ___)
# Print the results
auc_tree
auc_bagged
auc_forest
auc_boost