Response is not integral
Hi All,
I am solving a multi-class classification problem using C_SVC type. After inputting data into my training_matrix (matrix for data) and training_labels_matrix (matrix for data's labels), I used train_auto to train the SVM.
Mat training_matrix(TRAINING_ROWS,2,CV_32FC1);
Mat training_label_matrix(TRAINING_ROWS,1,CV_32FC1);
//Above matrices are filled with data here
// ....
// ...
float weight[3] = {Parameter_C,Parameter_C,Parameter_C};
Mat weights(3,1,CV_32FC1,weight);
CvMat _weight = weights;
CvMat *_weightPtr = &_weight;
//Specify SVM Parameters
CvSVMParams params;
params.svm_type = CvSVM::C_SVC;
params.kernel_type = CvSVM::RBF;
params.class_weights = _weightPtr;
params.gamma = Gamma;
//Train the SVM
CvSVM SVM;
SVM.train_auto(training_matrix, training_label_matrix, Mat(), Mat(), params, 1000,
CvSVM::get_default_grid(CvSVM::C), CvSVM::get_default_grid(CvSVM::GAMMA)); <- Program crashed here
However, the error "OpenCV Error: Bad argument (response #0 is not integral) in cvPreprocessCategoricalResponses, file /opt/local/var/macports/build/_opt_mports_dports_graphics_opencv/opencv/work/opencv-2.4.6/modules/ml/src/inner_functions.cpp, line 715
terminate called throwing an exception(lldb)" comes up and I have no idea how to proceed.
Please help!
Thank you so much...