Assess
The time has come for a reckoning. Tune your model to find out the optimal penalty value and fit a final model to assess your work.
Your workflow, penalty grid, and user-defined class_evaluate()
function are available in your environment.
Cet exercice fait partie du cours
Feature Engineering in R
Instructions
- Set up a
tune_grid
to explore your model performance against ROC_AUC. - Select the best penalty value.
- Fit the final workflow with the best penalty.
Exercice interactif pratique
Essayez cet exercice en complétant cet exemple de code.
# Set up a tune grid to explore your model performance against roc_auc
lr_tune_output <- ___(lr_workflow, resamples = vfold_cv(train, v = 5),
metrics = metric_set(roc_auc), grid = lr_penalty_grid)
# Select the best penalty value
best_penalty <- ___(lr_tune_output, metric = 'roc_auc', desc(penalty))
# Fit the final workflow with the best penalty
lr_final_fit<- ___(lr_workflow, best_penalty) %>% fit(data = train)
lr_final_fit %>% augment(test) %>%
class_evaluate(truth = Attrition, estimate = .pred_class, .pred_Yes)