Aan de slagGa gratis aan de slag

Evaluating a classifier

To evaluate a classifier, we need to test it on images that were not used during training. This is called "cross-validation": a prediction of the class (e.g., t-shirt, dress or shoe) is made from each of the test images, and these predictions are compared with the true labels of these images.

The results of cross-validation are provided as one-hot encoded arrays: test_labels and predictions.

Deze oefening maakt deel uit van de cursus

Image Modeling with Keras

Cursus bekijken

Oefeninstructies

  • Multiply the arrays with each other and sum the result to find the total number of correct predictions.
  • Divide the number of correct answers (the sum) by the length of predictions array to calculate the proportion of correct predictions.

Praktische interactieve oefening

Probeer deze oefening eens door deze voorbeeldcode in te vullen.

# Calculate the number of correct predictions
number_correct = ____
print(number_correct)

# Calculate the proportion of correct predictions
proportion_correct = ____
print(proportion_correct)
Code bewerken en uitvoeren