ComenzarEmpieza gratis

Plain recipe

Using the attrition_num dataset with all numerical data about employees who have left the company, you want to build a model that can predict if an employee is likely to stay, using Attrition, a binary variable coded as a factor. To get started, you will define a plain recipe that does nothing other than define the model formula and the training data.

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

Este ejercicio forma parte del curso

Feature Engineering in R

Ver curso

Instrucciones del ejercicio

  • Create a plain recipe defining only the model formula.

Ejercicio interactivo práctico

Prueba este ejercicio y completa el código de muestra.

# Create a plain recipe defining only the model formula
lr_recipe_plain <- 
  ___(___ ~., ___ = ___)

lr_workflow_plain <- workflow() %>%
  add_model(lr_model) %>%
  add_recipe(lr_recipe_plain)
lr_fit_plain <- lr_workflow_plain %>%
  fit(train)
lr_aug_plain <-
  lr_fit_plain %>% augment(test)
lr_aug_plain %>% class_evaluate(truth = Attrition,
                 estimate = .pred_class,.pred_No)
Editar y ejecutar código