Difference between plotconfusion and Confusionmat function in MATLAB?

5 ビュー (過去 30 日間)
Machine Learning Enthusiast
Machine Learning Enthusiast 2017 年 7 月 9 日
コメント済み: Star Strider 2017 年 7 月 17 日
I tried to display my confusion matrix from actual and predicted values while using both functions
plotconfusion
  • and
Confusionmat.
Both give different results. It's really strange for me. It seems Confusionmat is the transpose of plotconfusion. What should I do to plot similar results of Confusionmat on plotconfusion?
plotconfusion:
59 0 0
0 68 0
0 3 48
Confusionmat:
59 0 0
0 68 3
0 0 48

回答 (1 件)

Star Strider
Star Strider 2017 年 7 月 9 日
Your interpretation of the function outputs being transposes of each other is correct.
From the confusionmat documentation:
  • C(i,j) is a count of observations known to be in group i but predicted to be in group j.
From the plotconfusion, documentation:
  • On the confusion matrix plot, the rows correspond to the predicted class (Output Class), and the columns show the true class (Target Class).
So they are in fact transposes of each other.
I would use one or the other for consistency, depending on what you are doing. If you need to compare the, transpose one to the other, and be certain to note what the rows and columns represent.
  2 件のコメント
Machine Learning Enthusiast
Machine Learning Enthusiast 2017 年 7 月 17 日
thank you.So what should i do to plot confusion matrix same as confusionmat funtion?
Star Strider
Star Strider 2017 年 7 月 17 日
My pleasure.
I do not have a clear idea of what you want. If you want the confusionmat plot from your plotconfusion output, use the patch function to create the plot and the text function to display the data values on it.
However, I would just use plotconfusion for the plot.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeImage Data Workflows についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by