預測流失
在這個練習中,你將使用 pROC 套件中的 predict() 函式,來預測測試集 test_set 中客戶的流失機率。
此函式有三個參數:
- 用來產生預測的模型。
newdata:要套用模型的資料集。type:預測的型別。我們想知道流失的機率,因此要選擇response或prob。
使用 predict() 函式來預測 test_set 中客戶的流失機率。
本練習屬於課程
使用 R 進行網路化資料的預測分析
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
# Load the package
library(pROC)
# Predict with the first model
firstPredictions <- predict(___, newdata = test_set, type = "response")