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

Method classificationTest

ml/src/svm_wrapper.cpp:532–652  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

530}
531
532bool
533pcl::SVMClassify::classificationTest()
534{
535 if (model_.l == 0) {
536 PCL_ERROR("[pcl::%s::classificationTest] Classifier model has no data.\n",
537 getClassName().c_str());
538 return false;
539 }
540
541 if (prob_.l == 0) {
542 PCL_ERROR("[pcl::%s::classificationTest] Input dataset has no data.\n",
543 getClassName().c_str());
544 return false;
545 }
546
547 if (!labelled_training_set_) {
548 PCL_ERROR("[pcl::%s::classificationTest] Input dataset is not labelled.\n",
549 getClassName().c_str());
550 return false;
551 }
552
553 if (predict_probability_) {
554 if (svm_check_probability_model(&model_) == 0) {
555 PCL_WARN("[pcl::%s::classificationTest] Classifier model does not support "
556 "probability estimates. Automatically disabled.\n",
557 getClassName().c_str());
558 predict_probability_ = false;
559 }
560 }
561 else {
562 if (svm_check_probability_model(&model_) != 0)
563 PCL_WARN("[pcl::%s::classificationTest] Classifier model supports probability "
564 "estimates, but disabled in prediction.\n",
565 getClassName().c_str());
566 }
567
568 int correct = 0;
569
570 int total = 0;
571 double error = 0;
572 double sump = 0, sumt = 0, sumpp = 0, sumtt = 0, sumpt = 0;
573
574 int svm_type = svm_get_svm_type(&model_);
575 int nr_class = svm_get_nr_class(&model_);
576 double* prob_estimates = nullptr;
577
578 prediction_.clear();
579
580 if (predict_probability_) {
581 if (svm_type == NU_SVR || svm_type == EPSILON_SVR)
582 PCL_WARN("[pcl::%s::classificationTest] Prob. model for test data: target value "
583 "= predicted value + z,\nz: Laplace distribution "
584 "e^(-|z|/sigma)/(2sigma),sigma=%g\n",
585 getClassName().c_str(),
586 svm_get_svr_probability(&model_));
587 else {
588 prob_estimates = static_cast<double*>(malloc(nr_class * sizeof(double)));
589 }

Callers

nothing calls this directly

Calls 11

svm_get_svm_typeFunction · 0.85
svm_get_nr_classFunction · 0.85
svm_get_svr_probabilityFunction · 0.85
svm_predict_probabilityFunction · 0.85
svm_predictFunction · 0.85
print_valueFunction · 0.85
getClassNameFunction · 0.50
clearMethod · 0.45
resizeMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected