1. Learn
  2. /
  3. Courses
  4. /
  5. Intermediate Deep Learning with PyTorch

Connected

Exercise

Multi-class model evaluation

Let's evaluate our cloud classifier with precision and recall to see how well it can classify the seven cloud types. In this multi-class classification task it is important how you average the scores over classes. Recall that there are four approaches:

  • Not averaging, and analyzing the results per class;
  • Micro-averaging, ignoring the classes and computing the metrics globally;
  • Macro-averaging, computing metrics per class and averaging them;
  • Weighted-averaging, just like macro but with the average weighted by class size.

Both Precision and Recall are already imported from torchmetrics. It's time to see how well our model is doing!

Instructions 1/2

undefined XP
  • 1
    • Define precision and recall metrics calculated globally on all examples.
  • 2
    • Change your code to compute separate recall and precision metrics for each class and average them with a simple average.