LoslegenKostenlos loslegen

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.

Diese Übung ist Teil des Kurses

Intermediate Regression in R

Kurs anzeigen

Interaktive Übung

Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.

# 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
Code bearbeiten und ausführen