构建精简模型
变量重要性分析帮助您从 attrition 数据集中找出了最具预测力的特征。基于此,您将仅使用三个变量:OverTime、DistanceFromHome 和 NumCompaniesWorked,构建一个大幅精简的模型,并将其与完整模型的基线进行对比。完整模型的评估指标已存储在 aug_full 中。
所有数据以及 train 和测试集切分,均已在您的环境中提供。
本练习是课程的一部分
R 中的特征工程
交互式实操练习
通过完成这段示例代码来试试这个练习。
# Create a recipe using the formula syntax that includes only OverTime, DistanceFromHome and NumCompaniesWorked as predictors
recipe_reduced <-
___(Attrition ~ ___ + ___ + ___, data = train)
# Bundle the recipe with your model
workflow_reduced <-
workflow() %>%
add_model(model) %>%
___