CommencerCommencer gratuitement

step_poly()

Now that you have a baseline, you can compare your model's performance if you add a polynomial transformation to all numerical values.

The attrition_numdata, the logistic regression lr_model, the user-defined class-evaluate() function, and the trainand test splits have already been loaded for you.

Cet exercice fait partie du cours

Feature Engineering in R

Afficher le cours

Instructions

  • Add a polynomial transformation to all numeric predictors.
  • Fit workflow to the train data.

Exercice interactif pratique

Essayez cet exercice en complétant cet exemple de code.

lr_recipe_poly <- 
  recipe(Attrition ~., data = train) %>%

# Add a polynomial transformation to all numeric predictors
  ___

lr_workflow_poly <- workflow() %>%
  add_model(lr_model) %>%
  add_recipe(lr_recipe_poly)

# Fit workflow to the train data
lr_fit_poly <- ___ %>% fit(train)
lr_aug_poly <- lr_fit_poly %>% augment(test)
lr_aug_poly %>% class_evaluate(truth = Attrition, estimate = .pred_class,.pred_No)
Modifier et exécuter le code