Probabilities from using predict function for fitcsvm

조회 수: 24 (최근 30일)
Frank Schiro
Frank Schiro 2019년 1월 6일
답변: Peter Krammer 2020년 8월 28일
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

답변 (2개)

Peter Krammer
Peter Krammer 2020년 8월 28일
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.

Vishal Bhutani
Vishal Bhutani 2019년 1월 9일
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."
For details regarding "classification scores" and "posterior probabilities" you can refer to section: More About->Classification score.
Hope it helps.

카테고리

Help CenterFile Exchange에서 MATLAB에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by