Ask Your Question

Inneart's profile - activity

2014-01-08 01:36:08 -0600 received badge  Student (source)
2013-09-12 11:29:30 -0600 commented question Response is not integral

Hi, the program crashed at SVM.train_auto(training_matrix, training_label_matrix, Mat(), Mat(), params, 1000,CvSVM::get_default_grid(CvSVM::C), CvSVM::get_default_grid(CvSVM::GAMMA));

2013-09-11 05:56:48 -0600 commented question Response is not integral

Edited my post to show code snippets. (I have 600 rows of training data and also 600 rows of training data labels)

2013-09-11 05:55:46 -0600 received badge  Editor (source)
2013-09-10 11:30:28 -0600 asked a question 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...