Customize your model assessment
Creating custom assessment functions is quite convenient when iterating through various models. The metric_set()
function from the yardstick
package can help you to achieve this.
Define a function that returns roc_auc
, accuracy
, sens
(sensitivity) and specificity spec
(specificity) and use it to assess your model.
The augmented data frame lr_aug
is already loaded and ready to go.
Cet exercice fait partie du cours
Feature Engineering in R
Instructions
- Define a custom assessment function that returns
roc_auc
,accuracy
,sens
, andspec
. - Assess your model using your new function on
lr_aug
to obtain the metrics you just chose.
Exercice interactif pratique
Essayez cet exercice en complétant cet exemple de code.
# Define a custom assessment function
class_evaluate <- ___(___, ___, sens, ___)
# Assess your model using your new function
___(___, truth = Attrition,
estimate = .pred_class,
.pred_No)