Distill y_true and y_pred from a confusion matrix

Viewed 150

I have a confusion matrix that I generated via Scikit-Learn. I was wondering if it were possible to reverse engineer it and get the y_true and y_pred given only the confusion matrix in Python. If there is nothing built in (like in Scikit-Learn), would someone mind providing a code snippet?

1 Answers

Its not possible to reverse-engineer y_true and y_pred from a given confusion matrix, as the confusion matrix is invariant to permutations of the elements of y_pred and y_true.

An easy example would be the following: Consider y_true=[0,1] and y_pred=[1, 0]. The confusion matrix is exactly the same than for y_true=[1, 0] and y_pred=[0, 1].

Related