Definition at line 1816 of file svm.cpp. References info(), svm_problem::l, Malloc, svm_model::param, svm_parameter::probability, svm_cross_validation(), and svm_problem::y. Referenced by svm_train(). 01818 { 01819 int i; 01820 int nr_fold = 5; 01821 double *ymv = Malloc(double,prob->l); 01822 double mae = 0; 01823 01824 svm_parameter newparam = *param; 01825 newparam.probability = 0; 01826 svm_cross_validation(prob,&newparam,nr_fold,ymv); 01827 for(i=0;i<prob->l;i++) 01828 { 01829 ymv[i]=prob->y[i]-ymv[i]; 01830 mae += fabs(ymv[i]); 01831 } 01832 mae /= prob->l; 01833 double std=sqrt(2*mae*mae); 01834 int count=0; 01835 mae=0; 01836 for(i=0;i<prob->l;i++) 01837 if (fabs(ymv[i]) > 5*std) 01838 count=count+1; 01839 else 01840 mae+=fabs(ymv[i]); 01841 mae /= (prob->l-count); 01842 info("Prob. model for test data: target value = predicted value + z,\nz: Laplace distribution e^(-|z|/sigma)/(2sigma),sigma= %g\n",mae); 01843 free(ymv); 01844 return mae; 01845 }
Here is the call graph for this function:
|