Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

SVM class weights

I am trying to tune my SVM classifier, so I have created a config file for not building the application of training/testing every time I change a parameter. Everything goes ok, but I have a little problem with the class_weights parameter: because I use a json, I need to know how does the parameter look like? I know that is is a CvMat pointer, but how many values do I give to it, one for each class? is it a 1-row Mat, or a 1-col Mat (like a vector)? Or it has a weight for each image (I do not think so)? So is it ok to read it as a vector and then create the Mat from it? Any suggestions?

SVM class weights

I am trying to tune my SVM classifier, so I have created a config file for not building the application of training/testing every time I change a parameter. Everything goes ok, but I have a little problem with the class_weights parameter: because I use a json, I need to know how does the parameter look like? I know that is is a CvMat pointer, but how many values do I give to it, one for each class? is it a 1-row Mat, or a 1-col Mat (like a vector)? Or it has a weight for each image (I do not think so)? So is it ok to read it as a vector and then create the Mat from it? Any suggestions?


And more: How to set the class_weights parameter? I have tried to do

cv::SVMParams parms;
parms.class_weights = someMat;

But it is not supported. What is the way to initialize a CvMat pointer, or object?