1. Learn
  2. /
  3. Courses
  4. /
  5. Machine Learning with Tree-Based Models in R

Exercise

Are you predicting correctly?

Your model should be as good as possible, right? One way you can assess this is by counting how often it predicted the correct classes compared to the total number of predictions it made. As discussed in the video, we call this performance measure accuracy. You can either calculate this manually or by using a handy shortcut. Both obtain the same result.

The confusion matrix diabetes_matrix and the tibble predictions_combined are loaded.

Instructions 1/3

undefined XP
    1
    2
    3
  • Print diabetes_matrix to the console and use its entries to directly calculate correct_predictions, the number of correct predictions.
  • Save the total number of predictions to all_predictions.
  • Calculate and the accuracy, save it to acc_manual, and print it.