開始使用免費開始

建立精簡模型

變數重要度分析已幫你從 attrition 資料集中找出最具預測力的特徵。根據結果,你將建立一個大幅精簡的模型,只使用三個變數:OverTimeDistanceFromHomeNumCompaniesWorked,並將其效能與完整模型的基準做比較。你為完整模型估計出的評估指標已儲存在 aug_full 中。

所有資料,以及 train 與 test 的切分,都已在你的環境中可用。

本練習屬於課程

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) %>%
  ___
編輯並執行程式碼