What do the values returned from cv::ml::StatModel::predict() when using the RAW_OUTPUT flag represent?


I’m using an SVM to predict if images are of one label or another. I wanted to get some more information from the cv::ml::StatModel::predict method, so I used the RAW_OUTPUT flag to get some value other than just the predicted label returned. However, I’m having trouble deciphering what the returned value actually represents. I was able to discern using my previous output that the predicted label depends on whether the value is positive or negative, but I wanted to be able to analyze the actual values returned with this flag.
My assumption was that this was the decision value and therefore the distance away from the hyperplane of the SVM, but the flag documentation describes this value as the sum?
What is this value and what does it represent?

E.g. training images with labels -1 and 1, the values returned by the predict method when using RAW_OUTPUT is between -4 and 10.

that is exactly, what you get.

no. (or not really) the decision value is a constant (learned during the training), and it is used to threshold the dot product between the margin and inference vector.
(however, this implementation just subtracts it from the dot / distance)

remember, the dot prod is the sum of the component products

so as a formula, like:

raw_value = dot(margin, query) - df
1 Like