How to extract true positive and true negative rates from confusion matrix obtained using classification learner

조회 수: 12 (최근 30일)
I used classification learner to produce confusion matrix. Large matrix does not show automatically numerical values on the figure itself. How to make matlab show all values (annotate) even if overlapping and second how can I extract information from this figure including true positive (TP), and false negative (FN) rates (without writing myself the whole code. When I export model I don't see those values in the workspace. I see only class probability and class count, but nothing that would point to FN and TP etc. Thank you for your help

채택된 답변

Mukul Rao
Mukul Rao 2017년 7월 19일
Hi,
I believe there is a limit of 20 classes for labels to be displayed in the confusion matrix. There is an existing enhancement request in place to clarify this in our documentation. I have updated this ticket reflect your pain point as well.
To answer your second question, you can export your model from the app and then use its "predictFcn" to evaluate its response for the training data. You can then use this result along with the true class values as inputs for the "confusionmat" function to retrieve the confusion matrix.
confusionmat(Y_actual,trainedModel.predictFcn(TrainingData__as_used_in_app))
Please note that the results will be slightly different from what you see in the Classification Learner App because the app uses 5-fold cross-validation by default. The validation scheme only affects the way that Classification Learner computes validation metrics. The final exported model is always trained using the full data set.
  댓글 수: 1
Jasmina Burek
Jasmina Burek 2017년 7월 20일
That was helpful. From that matrix result I was able to calculate TP, TN, etc using https://github.com/domargan/dummkopfclassify/blob/master/confusionmatStats.m#L62

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

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by