SimCLR
SimCLR copied to clipboard
Confusion matrix
Does anyone know how to add the confusion matrix in this code? After I added it according to the online one, something went wrong. I don't know what went wrong in my code.I can't solve it. please help help me! Thanks. def confusion_matrix(output, labels, conf_matrix):
preds = torch.argmax(output, dim=-1)
for p, t in zip(preds, labels):
conf_matrix[p, t] += 1
return conf_matrix