Probabilities from using predict function for fitcsvm
5 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hello,
When I fit a model with fitcsvm, and use predict for new data, I get a score for the predictions as one of the outputs.
The function has two columns, one for both classes of this binary classification.
The probabilities make no sense to me. For example, the 5th "score," or probabiliy, is +0.2431. Doesn't this mean the probability that it is NOT in the positive class is 1-.2431 = .7569 ? Why, if its only .2431, does it predict +1 as the class?
If I add the transformation Score=(1+Score)/2, would I then get a probability distribution for the probability that a label is +1, with probability between 0 and 1?
Thank you
FS
Réponses (2)
Peter Krammer
le 28 Août 2020
Hello,
- Your Score, (shown in column 3) is not representing the probablity. Probability is usually represents from 0 to 1 (Or 0 to 100 %). However your Score attribute contains negative numbers.
- 5-th row of your table, with score 0.2431 is classified as class +1, because distance of |1 - 0.2431| = 0.7569; is smaller than distance of class -1, which distance is |-1 - 0.2431| = 1.2431; (smaller distance indicates higher similarity)
- Your calculation NewScore=(1+Score)/2; looks very logical, and this NewScore could be a solid approximation of probability. However, from mathematical aspect, it is not exact probability. So , it could be used in some practical applications, but it is necessary to be careful.
0 commentaires
Vishal Bhutani
le 9 Jan 2019
From the documentation of "predict" function:
"[label,score] = predict(SVMModel,X) returns a matrix of scores (score) indicating the likelihood that a label comes from a particular class. For SVM, likelihood measures are either classification scores or class posterior probabilities. For each observation in X, the predicted class label corresponds to the maximum score among all classes."
Documentation link for function "predict": https://www.mathworks.com/help/stats/classreg.learning.classif.compactclassificationsvm.predict.html
For details regarding "classification scores" and "posterior probabilities" you can refer to section: More About->Classification score.
Hope it helps.
0 commentaires
Voir également
Catégories
En savoir plus sur Statistics and Machine Learning Toolbox dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!