预测流失
在本练习中,您将使用 pROC 包中的 predict() 函数来预测测试集 test_set 中客户的流失概率。
该函数有 3 个参数:
- 用于进行预测的模型。
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")