0
$\begingroup$

I was offered a confusion matrix, which is called Parametrised 5x5 confusion matrix by authors where I extracted the values and where the diagonal has the correct results (0 in all); the results are bad, which can be seen in the confusion matrix; they do not understand why; in ideal situation, all values should be zero that is no failures should occur; I would like to visualise the matrix somehow to explain how interpret such non-standard confusion matrix

Real Prediction
     A  B  C  D  E
A    0  1  1  1  1 
B    1  0  2  2  2 
C    2  2  0  3  3
D    3  3  3  0  4
E    4  4  4  4  0

Claims

  1. it is critical to have cells wrong in column(2-5) - row(2-5) i.e. the lower right square matrix; the authors put equal critical grade on all these cells
  2. Column A and row A are ok.

Visualisation attempts

I am thinking if cells of column(2-5) - row(2-5) can visualised individually like in normal confusion matrix, since the deviation from the diagonal indicates the severity.

  • Unable to use fourfoldplot for the inspection in R 3.1.1

    # http://stackoverflow.com/questions/23891140/r-how-to-visualize-confusion-matrix-using-the-caret-package
    ctable <- as.table(matrix(c(0, 1, 1, 1, 1, 1, 0, 2, 2, 2, 2, 2, 0, 3, 3, 3, 3, 3, 0, 4, 4, 4, 4, 4, 0), nrow = 5, byrow = TRUE))
    fourfoldplot(ctable, color = c("#CC6666", "#99CC99"),
             conf.level = 0, margin = 1, main = "Confusion Matrix")
    
    > install.packages("fourfoldplot")
    Installing package into ‘/usr/local/lib/R/site-library’
    (as ‘lib’ is unspecified)
    --- Please select a CRAN mirror for use in this session ---
    
    Warning message:
    package ‘fourfoldplot’ is not available (for R version 3.1.1) 
    
  • Attempt in Mathematica

    MatrixPlot[{ {0, 1, 1, 1, 1}, {1, 0, 2, 2, 2}, {2, 2, 0, 3, 3}, {3, 3, 3, 0, 4}, {4, 4, 4, 4, 0}}]
    
    • Fig. 1 Output of the Mathematica code where you

      enter image description here

Fig. 1 proposes me that the critical points are column1-row5 and column1-(row1-4) whch are brightest colored (orange) while the original claim that the whole lower square matrix column(2-5)-row(2-5) are equally all wrong. To claim that column1-row5 is right does not make sense.

How can you classify/interpet such a confusion matrix?

$\endgroup$
7
  • 1
    $\begingroup$ Are you sure this is a confusion matrix? The columns are ordered 1-4, so it makes me think this is reflecting some kind of ranking rather than counts of misclassification. Also, do you mean lower-left triangle? $\endgroup$
    – Wayne
    Commented Oct 4, 2016 at 17:52
  • $\begingroup$ You/they are using the term "Confusion Matrix" in a nonstandard way, which will make it difficult to answer your question for most readers. See en.wikipedia.org/wiki/Confusion_matrix for the usual meaning. They may be only including only wrong classifications -- hence the 0's on the diagonal -- which is non-standard, but the 1-4 repeated in-order in the columns is totally unrealistic and looks more like them ranking something. $\endgroup$
    – Wayne
    Commented Oct 4, 2016 at 18:15
  • 2
    $\begingroup$ Are you sure you're not recreating the CrossValidated symbol? $\endgroup$
    – Firebug
    Commented Oct 4, 2016 at 19:44
  • 1
    $\begingroup$ There's some confusion going on: the table has two axis, "Real" and "Truth". Confusion matrices are usually labeled like "Truth" vs "Prediction". $\endgroup$
    – Firebug
    Commented Oct 4, 2016 at 19:48
  • 1
    $\begingroup$ I'm a medical physicist, perhaps just a bit of context could help to elucidate the question. The point raised by @Wayne is also valid, this sounds more like some sort of ranking, like an error cost matrix. $\endgroup$
    – Firebug
    Commented Oct 4, 2016 at 19:53

1 Answer 1

3
$\begingroup$

Per @Firebug's comment, this looks like an error cost matrix:

Real Prediction
     A  B  C  D  E
A    0  1  1  1  1 
B    1  0  2  2  2 
C    2  2  0  3  3
D    3  3  3  0  4
E    4  4  4  4  0

It looks like the classes are ordinal, with A high and E low and the cost for a correct prediction is 0, and the cost for predicting higher than actual is lower than predicting lower than actual. So if you predict a C as a C, you get no penalty, if you predict it as an A or B (higher) you get a 2 penalty, and if you predict id as a D or E (lower), you get a 3 penalty.

The penalties wrap around, so that predicting high on an E is the same as predicting low on a D, and the penalty for predicting high on a D is the same as predicting low on a C.

Sound right? I think this is being mixed up with a confusion matrix, which normally indicates the number of predictions of each type versus the actual classes. The best-case scenario is all numbers on the diagonal (prediction and actual agree) and all zero off-diagonal.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.