CommencerCommencer gratuitement

Confusion matrix

When the response variable has just two outcomes, like the case of churn, the measures of success for the model are "how many cases where the customer churned did the model correctly predict?" and "how many cases where the customer didn't churn did the model correctly predict?". These can be found by generating a confusion matrix and calculating summary metrics on it. A mosaic plot is the natural way to visualize the results.

churn and mdl_churn_vs_both_inter are available; dplyr and yardstick are loaded.

Cet exercice fait partie du cours

Intermediate Regression in R

Afficher le cours

Exercice interactif pratique

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

# Get the actual responses from churn
actual_response <- ___

# Get the predicted responses from the model
predicted_response <- ___

# Get a table of these values
outcomes <- ___

# Convert the table to a conf_mat object
confusion <- ___

# See the result
confusion
Modifier et exécuter le code