So I got training data with double features and accompanied integer labels. Since I want binary classification I give one class 1 labels and other class -1 labels. Training data is a matrix with amount of samples as rows and with features as columns.
Training is set up as
// Set up SVM's parameters
Ptr<SVM> svm1 = SVM::create();
svm1->setType(SVM::C_SVC);
svm1->setKernel(SVM::LINEAR);
svm1->setTermCriteria(TermCriteria(TermCriteria::MAX_ITER, 100, 1e-6));
svm1->train(trainingDataSVM1, ROW_SAMPLE, labelsSVM1);
cerr << "SVM 1 trained and ready to use!" << endl;
While testing is done with
// Classify the labels of the testing data
Mat labelsTest( testData.rows, 1, CV_32SC1);
svm1->predict(testData, labelsTest);
cerr << "Labels: ";
for(int i=0; i < labelsTest.rows; i++){
cerr << labelsTest.at<int>(i, 0) << " / ";
}
cerr << endl;
Now this generates the following output, which is quite unusual
SVM 1 trained and ready to use!
Labels: -1082130432 / 1065353216 / 1065353216 / 1065353216 / 1065353216 / 1065353216 / 1065353216 / 1065353216 / 1065353216 /
What concerns me is that
- Training goes extremely fast, its like instant, but that can be due to the low amount of training samples, for 1 class it is 42 while for the -1 class it is 40. But still it seems that SVM should take time to train?
- I have a binary SVM so how does he finds those extreme large values.