Confusion Matrix for ECOC model classification Example

조회 수: 2 (최근 30일)
AbioEngineer
AbioEngineer 2019년 8월 21일
댓글: AbioEngineer 2019년 8월 31일
Running this example in the Command Window:
openExample('textanalytics/CreateSimpleTextModelForClassificationExample')
Is there any way of creating a Confusion Matrix for a cross validated version of the above ECOC model? Similar to this example:
openExample('stats/TrainECOCClassifiersUsingEnsemblesAndParallelComputingExample')
Is the problem with the type of Learner during the fitECOC step? or is it because the class labels are contained in a cell array of strings, and are non-numeric like in the second example?
the error I get when using crossval is that the first input argument must be 'mse', 'mcr', or a function handle. I am trying to do a simple classification of only 2 classes, so I'd expect a 2x2 confusion matrix. I don't think I need start a parallel pool or use a very complicated learner for my NLP text classification.

채택된 답변

Gaurav Garg
Gaurav Garg 2019년 8월 29일
Hi,
In my understanding, you wish to know a way to create a confusion matrix for the example textanalytics/CreateSimpleTextModelForClassificationExample.
You can use confusionmat function which compute confusion matrix for classification problems. For the above example, the following code shall give you the confusion matrix -
[cm,grp]=confusionmat(YTest,YPred)
And as far as 2x2 confusion matrix is concerned, since you have multiple classes, you are expected to receive a matrix of dimensions nxn where n is the number of classes. In the output matrix, cell (i,j) denotes the class i which has been labelled as class j.
  댓글 수: 1
AbioEngineer
AbioEngineer 2019년 8월 31일
Thank you. But how do I get a nicely colored matrix like the second example's cross validation model?

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Classification Learner App에 대해 자세히 알아보기

제품


릴리스

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by