Using Regressor along with OpenCV SVM Class
There is a function from old libsvm module:
score = svm_predict_probability(model, x, prob_estimates);
Where model is the trained model, x is the struct svm_node (like a dictionary, having value and indexes) and prob_estimates is defined as:
int nr_class=svm_get_nr_class(model);
double prob_estimates = (double *) malloc(nr_classsizeof(double));
I want to use it using OpenCV SVM Class. it's aregression problem where score (the final output) ranges from 0 to 100. I'm not sure how to do it? (Except loading the svm model and it's parameters).
hi ;)
what's your data like ? how many classes ?
Hello again @berak. Well, I've taken database from http://live.ece.utexas.edu/research/Q... and classes - there are around 6 classes to know which distortion was there.
oh, this brisque thing again.
@berak have shared the link. https://github.com/krshrimali/Image-M...
idk, maybe you should stick with libsvm here ? (as uncomfortable and awkward as it is..)
opencv's svm does not have a proper way to calculate probabilites. you can use RAW_OUTPUT in the prediction, but that only gives you the distance to the margin (which only makes sense in a 2-class context, so you'd have to split it into 6 one-class-against-all-others SVM's). you would need PLATT scaling (or, lacking that, because A,B would need to be calculated in the training, maybe a simple sigmoid function), to make probabilities from that.
Oh! Yes, @berak ... I think this is a better idea compared to what other options I've. Thanks again for your help and time.
btw, what are your 2 classes ?
2 classes? I guess there are 6 classes.
ok. thanks. misread it from the allmodel then. (the training code has indeed
65 !!)nr_class in allmodel says 2... Hmm, need to recheck what are the 2 classes then.