评估集成模型
目前为止一切顺利。但到底有多好呢?通过对样本外 AUC 进行交叉验证,来展示您的模型评估能力!
规范 boost_spec 和 customers_train tibble 仍已加载。
本练习是课程的一部分
R 中的树模型机器学习
练习说明
- 为训练集创建 5 折交叉验证,并保存为
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
___