Generate confusion matrix like in classification learner app programmatically

12 ビュー (過去 30 日間)
Mustrum Ridcully
Mustrum Ridcully 2016 年 7 月 9 日
回答済み: YT 2017 年 12 月 14 日
The classification learner app provided with the Statistics and Machine Learning Toolbox generates a plot of the confusion matrix with colored cells. Is it possible to generate the same plot programmatically, without passing through the app? It is very time consuming to always use the app when the number of plots to generate is high.

回答 (3 件)

Ali Farmanesh
Ali Farmanesh 2017 年 6 月 29 日
I think you can use a toolbox for solve your problem.One of this classification toolbox's (it is free) for MATLAB has been released by Milano Chemometrics and QSAR research Group. You can download the toolbox from the link below and also inform about toolbox. http://michem.disat.unimib.it/chm/download/softwares/help_classification/index.htm
  1 件のコメント
Mustrum Ridcully
Mustrum Ridcully 2017 年 7 月 7 日
My question was not about obtaining the data inside the confusion matrix, but rather about the actual graphical representation of the matrix itself, with the colors from green to red representing correct classification versus incorrect. For example, a basic matrix obtained with the Fisher Iris dataset is
This is a screen capture of the Classification Learner App provided by the Toolbox.
I haven't found any way to generate the same graphical representation programmatically, without passing via the app each and every time.

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


Baptiste Ottino
Baptiste Ottino 2017 年 8 月 8 日
Hello Mustrum,
If you want the exact confusion matrix from the app, the path to the configuration m-file is the following:
MATLAB_R2016b.app/toolbox/stats/mlearnapp/+mlearnapp/+internal/+ui/ConfusionMatrixView.m
But rather than copying that, which could be tedious, you coud just adapt the one from the Neural Network Toolbox, if you happen to own it:
doc plotconfusion
Best of luck!

YT
YT 2017 年 12 月 14 日
If you want fast and almost same result, then maybe it's best to use:
plotconfusion(your_confusion_matrix);
But if you want to programmatically do it yourself, in case you need multiple confusionmatrices plotted in one figure using subplot:

カテゴリ

Help Center および File ExchangeClassification についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by