The best parameter for prob outputs may be different from the setting
without..
See also the following faq
Q: Why using svm-predict -b 0 and -b 1 gives different accuracy values?
Let's just consider two-class classification here. After probability
information is obtained in training, we do not have
prob > = 0.5 if and only if decision value >= 0.
So predictions may be different with -b 0 and 1.
On 2019-09-27 01:22, Zheng Li wrote:
Hi, I use libSVM to develop my face recognition system,I use the
libSVM to find the closet face feature and identify target person,but
I found when I call svm_predict_probability() to do the prediction,the
accuracy is very low,and when I call svm_predict(), the accuracy is
high,because I need the probability param to check similarity , so I
want to know why svm_predict_probability()'s accuracy is so low?
below is my code to create the svm_model:
inline void fillLibSvmNodes(std::vector &fea, std::vector
&line_x_space)
{
size_t featuresNb = fea.size();
assert((fea.size() + 1) == line_x_space.size());
for (int i = 0; i < featuresNb; i++)
{
line_x_space[i].index = i + 1;
line_x_space[i].value = (double)fea[i];
}
line_x_space[featuresNb].index = -1;
}
void testLibSVM()
{
// dbFaceFeatures is a global variable to store the load face
features, it is vector<pair<string,vector>> type,the face feature is
512D;
assert(dbFaceFeatures.size() > 0);
int featuresNb = (int)dbFaceFeatures[0].second.size(); //
featuresNb=512
y_space.resize(dbFaceFeatures.size()); // y_space is vector
type
prob.y = y_space.data();
for (size_t i = 0; i < y_space.size(); i++)
y_space.at(i) = (double)(i + 1);
The best parameter for prob outputs may be different from the setting without.. See also the following faq
Q: Why using svm-predict -b 0 and -b 1 gives different accuracy values?
Let's just consider two-class classification here. After probability information is obtained in training, we do not have
prob > = 0.5 if and only if decision value >= 0.
So predictions may be different with -b 0 and 1.
On 2019-09-27 01:22, Zheng Li wrote:
Originally posted by @cjlin1 in https://github.com/cjlin1/libsvm/issues/152#issuecomment-535949617