Aan de slagGa gratis aan de slag

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.

Deze oefening maakt deel uit van de cursus

Machine Learning with Tree-Based Models in R

Cursus bekijken

Praktische interactieve oefening

Probeer deze oefening eens door deze voorbeeldcode in te vullen.

# Calculate the number of correctly predicted classes
correct_predictions <- 75 + ___

# Calculate the number of all predicted classes
all_predictions <- ___ + ___ + 18 + ___

# Calculate and print the accuracy
acc_manual <- ___ / ___
___
Code bewerken en uitvoeren