What do the "scores" mean that result from application of a model from the Classification Learner App to new data?
9 次查看(过去 30 天)
显示 更早的评论
What do the "scores" mean that result from application of a model from the Classification Learner App to new data? They really don't seem to make any sense. The class selected doesn't equate to the highest or lowest score in the resulting scores matrix so I am wondering what they mean in some substantive sense?
0 个评论
回答(1 个)
Drew
2023-10-2
I'll assume you are following the workflow here: https://www.mathworks.com/help/stats/export-classification-model-for-use-with-new-data.html and running something like
[yfit,scores] = C.predictFcn(T)
The precise meaning of the scores depends on the type of classifier that you have trained. For most classifier types, the predicted class will correspond to the class with the highest score. However, the KNN, Naive Bayes, and Discrimant classifiers can be different when non-default misclassification costs are provided. For example, for a KNN classifier, the scores correspond to posterior probabilities which do not yet take misclassification costs into account. For a KNN classifier, the class with the minimum expected cost (rather than the maximum posterior probability score) will correspond to the predicted class. See https://www.mathworks.com/help/stats/classificationknn.predict.html , which indicates that the KNN predict function provides a third output which constains the expected cost after taking into account the misclassification costs:
% Example of predict function for KNN, with third output, the expected cost
[label,score,cost] = predict(mdl,X)
So, in the case of a KNN classifier, you will want to add a third output to your predict function in order to look at the expected costs.
If this doesn't answer your question, perhaps you can provide more details such as the classifier type that you trained and an example result.
If this answer helps you, please remember to accept the answer.
4 个评论
Drew
2023-10-6
The order of the output scores is indicated in the ClassNames property of the model.
For example, for a CubicSVM trained on fisheriris in Classification Learner, then exported as "trainedModel", here is the ClassNames property:
>> trainedModel.ClassificationSVM.ClassNames
ans =
3×1 cell array
{'setosa' }
{'versicolor'}
{'virginica' }
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Discriminant Analysis 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!