以下代码生成一个异常说:



我想知道为什么将它设置为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();

有人可以帮忙吗?

最佳答案

来自opencv文档:The grid is logarithmic, so step must always be greater then 1.

关于opencv - opencv(SVM)-参数nu超出范围,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/25047899/

10-10 20:01