ComenzarEmpieza gratis

Draw the ROC curve

Visualizing model performance with a ROC curve allows you to gather the performance across all possible thresholds into a single plot. It shows the sensitivity and specificity for every threshold. The more "up and left" a ROC curve is, the better the model.

You are going to predict class probabilities of credit card customers having churned and plot the results as a ROC curve.

Pre-loaded is a model, which is a decision tree that was trained on the credit card customers training set, and the test data, customers_test.

Este ejercicio forma parte del curso

Machine Learning with Tree-Based Models in R

Ver curso

Instrucciones del ejercicio

  • Use model to predict class probabilities on the test set.
  • Add the results to the test set using bind_cols() and save the result as predictions.
  • Calculate the ROC curve of the result.
  • Plot the ROC curve using autoplot().

Ejercicio interactivo práctico

Prueba este ejercicio completando el código de muestra.

# Predict probabilities on test set
predictions <- predict(___, 
                       ___, 
                       type = "___") %>% 
  # Add test set
  ___(customers_test)

# Calculate the ROC curve for all thresholds
roc <- ___(___,
           estimate = ___, 
           truth = ___)

# Plot the ROC curve
___
Editar y ejecutar código