Show grid of how often a given situation occurs


I am trying to predict injury time in a football match, but my results are not too good.

I want to get a matrix/grid/plot where declared minutes of injury time is on the x-axis and predicted minutes of injury time is on the y-axis. In each position I want to know the precentage of this outcome. So, in (1,1) I want the precentage of how often my model predicts 1 minute if 1 minute is declared, in (1,2) I want to know how often 2 minutes is predicted, but only 1 minute is declared, and so on. There is a name for this, but I can’t remember.

Hopefully somebody can help me implement this in pytorch.

Thank you in advance!

It sounds as if you are looking to implement a confusion matrix?

Yes, I would like to implement a confusion matrix!

In that case you could use sklearn.metrics.confusion_matrix or implement it directly in PyTorch (we have some implementations in this forum, e.g. here).