python - How can I analyze a confusion matrix? -
when print out scikit-learn's confusion matrix, receive huge matrix. want analyze true positives, true negatives etc. how can so? how confusion matrix looks like. wish understand better.
[[4015 336 0 ..., 0 0 2] [ 228 2704 0 ..., 0 0 0] [ 4 7 19 ..., 0 0 0] ..., [ 3 2 0 ..., 5 0 0] [ 1 1 0 ..., 0 0 0] [ 13 1 0 ..., 0 0 11]]
iiuc, question undefined. "false positives", "true negatives" - these terms defined binary classification. read more definition of confusion matrix.
in case, confusion matrix of dimension n x n. each diagonal represents, entry (i, i) case prediction i , outcome i too. other off-diagonal entry indicates mistake prediction i , outcome j. there no meaning "positive" , "negative in case.
you can find diagnoal elements using np.diagonal
, and, following that, easy sum them. sum of wrong cases sum of matrix minus sum of diagonal.
Comments
Post a Comment