MCPcopy Create free account
hub / github.com/PointCloudLibrary/pcl / svm_check_parameter

Function svm_check_parameter

ml/src/svm.cpp:3456–3563  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3454}
3455
3456const char*
3457svm_check_parameter(const svm_problem* prob, const svm_parameter* param)
3458{
3459 // svm_type
3460
3461 int svm_type = param->svm_type;
3462
3463 if (svm_type != C_SVC && svm_type != NU_SVC && svm_type != ONE_CLASS &&
3464 svm_type != EPSILON_SVR && svm_type != NU_SVR)
3465 return "unknown svm type";
3466
3467 // kernel_type, degree
3468
3469 int kernel_type = param->kernel_type;
3470
3471 if (kernel_type != LINEAR && kernel_type != POLY && kernel_type != RBF &&
3472 kernel_type != SIGMOID && kernel_type != PRECOMPUTED)
3473 return "unknown kernel type";
3474
3475 if (param->gamma < 0)
3476 return "gamma < 0";
3477
3478 if (param->degree < 0)
3479 return "degree of polynomial kernel < 0";
3480
3481 // cache_size,eps,C,nu,p,shrinking
3482
3483 if (param->cache_size <= 0)
3484 return "cache_size <= 0";
3485
3486 if (param->eps <= 0)
3487 return "eps <= 0";
3488
3489 if (svm_type == C_SVC || svm_type == EPSILON_SVR || svm_type == NU_SVR)
3490 if (param->C <= 0)
3491 return "C <= 0";
3492
3493 if (svm_type == NU_SVC || svm_type == ONE_CLASS || svm_type == NU_SVR)
3494 if (param->nu <= 0 || param->nu > 1)
3495 return "nu <= 0 or nu > 1";
3496
3497 if (svm_type == EPSILON_SVR)
3498 if (param->p < 0)
3499 return "p < 0";
3500
3501 if (param->shrinking != 0 && param->shrinking != 1)
3502 return "shrinking != 0 and shrinking != 1";
3503
3504 if (param->probability != 0 && param->probability != 1)
3505 return "probability != 0 and probability != 1";
3506
3507 if (param->probability == 1 && svm_type == ONE_CLASS)
3508 return "one-class SVM probability output not supported yet";
3509
3510 // check whether nu-svc is feasible
3511
3512 if (svm_type == NU_SVC) {
3513 int l = prob->l;

Callers 1

trainClassifierMethod · 0.85

Calls 1

minFunction · 0.70

Tested by

no test coverage detected