Definition at line 1459 of file svm.cpp. References C_SVC, EPSILON_SVR, info(), svm_problem::l, Malloc, NU_SVC, NU_SVR, Solver::SolutionInfo::obj, ONE_CLASS, Solver::SolutionInfo::rho, solve_c_svc(), solve_epsilon_svr(), solve_nu_svc(), solve_nu_svr(), solve_one_class(), svm_parameter::svm_type, Solver::SolutionInfo::upper_bound_n, Solver::SolutionInfo::upper_bound_p, and svm_problem::y. Referenced by svm_train(). 01462 { 01463 double *alpha = Malloc(double,prob->l); 01464 Solver::SolutionInfo si; 01465 switch(param->svm_type) 01466 { 01467 case C_SVC: 01468 solve_c_svc(prob,param,alpha,&si,Cp,Cn); 01469 break; 01470 case NU_SVC: 01471 solve_nu_svc(prob,param,alpha,&si); 01472 break; 01473 case ONE_CLASS: 01474 solve_one_class(prob,param,alpha,&si); 01475 break; 01476 case EPSILON_SVR: 01477 solve_epsilon_svr(prob,param,alpha,&si); 01478 break; 01479 case NU_SVR: 01480 solve_nu_svr(prob,param,alpha,&si); 01481 break; 01482 } 01483 01484 info("obj = %f, rho = %f\n",si.obj,si.rho); 01485 01486 // output SVs 01487 01488 int nSV = 0; 01489 int nBSV = 0; 01490 for(int i=0;i<prob->l;i++) 01491 { 01492 if(fabs(alpha[i]) > 0) 01493 { 01494 ++nSV; 01495 if(prob->y[i] > 0) 01496 { 01497 if(fabs(alpha[i]) >= si.upper_bound_p) 01498 ++nBSV; 01499 } 01500 else 01501 { 01502 if(fabs(alpha[i]) >= si.upper_bound_n) 01503 ++nBSV; 01504 } 01505 } 01506 } 01507 01508 info("nSV = %d, nBSV = %d\n",nSV,nBSV); 01509 01510 decision_function f; 01511 f.alpha = alpha; 01512 f.rho = si.rho; 01513 return f; 01514 }
Here is the call graph for this function:
|