开始使用免费开始使用

完成特征工程流水线

recipes 包用于将多个特征工程步骤编码到一个对象中,便于在机器学习流程中统一维护数据变换。

在本练习中,您将训练一条特征工程流水线,为电信数据建模做准备。

tibble 对象 telecom_df,以及您在前面练习中得到的 telecom_trainingtelecom_test 数据集,均已加载到您的工作区。

本练习是课程的一部分

在 R 中使用 tidymodels 建模

查看课程

练习说明

  • 创建一个配方(recipe),使用训练数据中的所有自变量来预测 canceled_service
  • 使用阈值 0.8 移除高度相关的自变量。
  • 对所有数值型自变量进行归一化。
  • 为所有分类型自变量创建虚拟变量。
  • 在训练数据上训练您的配方,并将其应用到测试数据。

交互式实操练习

通过完成这段示例代码来试试这个练习。

# Create a recipe that predicts canceled_service using the training data
telecom_recipe <- ___ %>% 
  # Remove correlated predictors
  ___ %>% 
  # Normalize numeric predictors
  ___ %>% 
  # Create dummy variables
  ___

# Train your recipe and apply it to the test data
telecom_recipe %>% 
  ___ %>% 
  ___
编辑并运行代码