opencv(SVM) - 参数nu超出范围

时间:2014-07-30 22:16:13

标签: opencv exception svm

以下代码生成一个例外说明:

  

其中一个参数'值超出范围 - 参数nu必须介于0和1之间

我想知道为什么当我已经将它设置为0到1之间时会发生这种情况。

CvSVM svm;
CvParamGrid CvParamGrid_C(pow(2.0,-5), pow(2.0,15), pow(2.0,2));
CvParamGrid CvParamGrid_gamma(pow(2.0,-15), pow(2.0,3), pow(2.0,2));
CvParamGrid CvParamGrid_nu(0.4, 0.8,0.1);
const cv::Mat labelsMat(250, 1, CV_32FC1, labels);
const cv::Mat trainingDataMat(250,35, CV_32FC1, trainingData);
CvSVMParams paramz;
paramz.kernel_type = CvSVM::RBF;   paramz.svm_type = CvSVM::NU_SVR;
paramz.term_crit = cvTermCriteria(CV_TERMCRIT_ITER,100,0.000001);
svm.train_auto(trainingDataMat, labelsMat, cv::Mat(), cv::Mat(), paramz, 5, 
               CvParamGrid_C, CvParamGrid_gamma, CvSVM::get_default_grid(CvSVM::P),
               CvParamGrid_nu,vSVM::get_default_grid(CvSVM::COEF),
               CvSVM::get_default_grid(CvSVM::DEGREE), true);
paramz = svm.get_params();

有人可以帮忙吗?

1 个答案:

答案 0 :(得分:0)