Skip to main content
Tweeted twitter.com/StackMma/status/1140726017381818369
edited title
Link
user64494
  • 29.1k
  • 4
  • 29
  • 56

Creating/plotting and Plotting a ConfusionMatrixConfusion Matrix from a plainPlain Matrix

Source Link
Picaud Vincent
  • 2.5k
  • 14
  • 23

Creating/plotting a ConfusionMatrix from a plain Matrix

Using ClassifierMeasurementsObject you can plot nice ConfusionMatrix:

enter image description here

But how to mimic this matrix plot from a plain Matrix?

In other terms, from

M={{2,0},{1,1}}
k={"A","B"}

I would like to reproduce the previous plot.

So far I tried:

MatrixPlot[M,Frame->True,
             FrameLabel->{"actual","predicted"},
             ColorFunction->"Rainbow"]

enter image description here

but a lot of things are missing.

The most important are:

  • numbers in the plot

  • tick labels (note that they are rotated which is important as I have long names)