How to extract true positive and true negative rates from confusion matrix obtained using classification learner
12 views (last 30 days)
Show older comments
Jasmina Burek
on 13 Jul 2017
Commented: Jasmina Burek
on 20 Jul 2017
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
0 Comments
Accepted Answer
Mukul Rao
on 19 Jul 2017
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.
More Answers (0)
See Also
Categories
Find more on Classification Learner App in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!