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

36 ビュー (過去 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 件)

Community Treasure Hunt

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

Start Hunting!

Translated by