Get startedGet started for free

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.

This exercise is part of the course

Intermediate Regression in R

View Course

Hands-on interactive exercise

Have a go at this exercise by completing this sample 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
Edit and Run Code