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!