Point Cloud Library (PCL) 1.15.1
Loading...
Searching...
No Matches
pcl::SVMTrain Class Reference

SVM (Support Vector Machines) training class for the SVM machine learning. More...

#include <pcl/ml/svm_wrapper.h>

Inheritance diagram for pcl::SVMTrain:

Public Member Functions

 SVMTrain ()
 Constructor.
 ~SVMTrain ()
 Destructor.
void setParameters (SVMParam param)
 Change default training parameters (pcl::SVMParam).
SVMParam getParameters ()
 Return the current training parameters.
SVMModel getClassifierModel ()
 Return the result of the training.
void setInputTrainingSet (std::vector< SVMData > training_set)
 It adds/store the training set with labelled data.
std::vector< SVMDatagetInputTrainingSet ()
 Return the current training set.
void resetTrainingSet ()
 Reset the training set.
bool trainClassifier ()
 Start the training of the SVM classifier.
bool loadProblem (const char *filename)
 Read in a problem (in svmlight format).
void setDebugMode (bool in)
 Set to 1 for debugging info.
bool saveTrainingSet (const char *filename)
 Save the raw training set in a file (in svmlight format).
bool saveNormTrainingSet (const char *filename)
 Save the normalized training set in a file (in svmlight format).
Public Member Functions inherited from pcl::SVM
 SVM ()
 Constructor.
 ~SVM ()
 Destructor.
void getLabel (std::vector< int > &labels)
 Return the labels order from the classifier model.
void saveClassifierModel (const char *filename)
 Save the classifier model in an extern file (in svmlight format).

Protected Member Functions

void doCrossValidation ()
 To cross validate the classifier.
void scaleFactors (std::vector< SVMData > training_set, svm_scaling &scaling)
 It extracts scaling factors from the input training_set.
Protected Member Functions inherited from pcl::SVM
char * readline (FILE *input)
 To read a line from the input file.
void exitInputError (int line_num)
 Outputs an error in file reading.
const std::string & getClassName () const
 Get a string representation of the name of this class.
void adaptInputToLibSVM (std::vector< SVMData > training_set, svm_problem &prob)
 Convert the input format (vector of SVMData) into a readable format for libSVM.
void adaptLibSVMToInput (std::vector< SVMData > &training_set, svm_problem prob) const
 Convert the libSVM format (svm_problem) into a easier output format.
bool loadProblem (const char *filename, svm_problem &prob)
 Load a problem from an extern file.
bool saveProblem (const char *filename, bool labelled)
 Save the raw problem in an extern file.
bool saveProblemNorm (const char *filename, svm_problem prob_, bool labelled)
 Save the problem (with normalized values) in an extern file.

Protected Attributes

bool debug_ {false}
 Set to 1 to see the training output.
int cross_validation_ {0}
 Set too 1 for cross validating the classifier.
int nr_fold_ {0}
 Number of folds to be used during cross validation.
std::string class_name_
bool labelled_training_set_
char * line_
int max_line_len_
SVMModel model_
SVMParam param_
svm_problem prob_
svm_scaling scaling_
std::vector< SVMDatatraining_set_
Protected Attributes inherited from pcl::SVM
std::vector< SVMDatatraining_set_
svm_problem prob_
SVMModel model_
svm_scaling scaling_
SVMParam param_
std::string class_name_
char * line_ {nullptr}
int max_line_len_ {10000}
bool labelled_training_set_

Additional Inherited Members

Static Protected Member Functions inherited from pcl::SVM
static void printNull (const char *)
 Set for output printings during classification.

Detailed Description

SVM (Support Vector Machines) training class for the SVM machine learning.

It creates a model for the classifier from a labelled input dataset.

OPTIONAL: pcl::SVMParam has to be given as input to vary the default training method and parameters.

Definition at line 235 of file svm_wrapper.h.

Constructor & Destructor Documentation

◆ SVMTrain()

pcl::SVMTrain::SVMTrain ( )
inline

Constructor.

Definition at line 268 of file svm_wrapper.h.

References class_name_, and pcl::SVM::printNull().

◆ ~SVMTrain()

pcl::SVMTrain::~SVMTrain ( )
inline

Destructor.

Definition at line 276 of file svm_wrapper.h.

References model_.

Member Function Documentation

◆ doCrossValidation()

void pcl::SVMTrain::doCrossValidation ( )
protected

To cross validate the classifier.

It is automatic for probability estimate.

◆ getClassifierModel()

SVMModel pcl::SVMTrain::getClassifierModel ( )
inline

Return the result of the training.

Definition at line 298 of file svm_wrapper.h.

References model_.

◆ getInputTrainingSet()

std::vector< SVMData > pcl::SVMTrain::getInputTrainingSet ( )
inline

Return the current training set.

Definition at line 312 of file svm_wrapper.h.

References training_set_.

◆ getParameters()

SVMParam pcl::SVMTrain::getParameters ( )
inline

Return the current training parameters.

Definition at line 291 of file svm_wrapper.h.

References param_.

◆ loadProblem()

bool pcl::SVMTrain::loadProblem ( const char * filename)
inline

Read in a problem (in svmlight format).

Returns
false if fails

Definition at line 336 of file svm_wrapper.h.

References pcl::SVM::loadProblem(), and prob_.

◆ resetTrainingSet()

void pcl::SVMTrain::resetTrainingSet ( )
inline

Reset the training set.

Definition at line 319 of file svm_wrapper.h.

References training_set_.

◆ saveNormTrainingSet()

bool pcl::SVMTrain::saveNormTrainingSet ( const char * filename)
inline

Save the normalized training set in a file (in svmlight format).

Returns
false if fails

Definition at line 368 of file svm_wrapper.h.

References prob_, and pcl::SVM::saveProblemNorm().

◆ saveTrainingSet()

bool pcl::SVMTrain::saveTrainingSet ( const char * filename)
inline

Save the raw training set in a file (in svmlight format).

Returns
false if fails

Definition at line 358 of file svm_wrapper.h.

References pcl::SVM::saveProblem().

◆ scaleFactors()

void pcl::SVMTrain::scaleFactors ( std::vector< SVMData > training_set,
svm_scaling & scaling )
protected

It extracts scaling factors from the input training_set.

The scaling of the training_set is a mandatory for a good training of the classifier.

◆ setDebugMode()

void pcl::SVMTrain::setDebugMode ( bool in)
inline

Set to 1 for debugging info.

Definition at line 343 of file svm_wrapper.h.

References debug_, and pcl::SVM::printNull().

◆ setInputTrainingSet()

void pcl::SVMTrain::setInputTrainingSet ( std::vector< SVMData > training_set)
inline

It adds/store the training set with labelled data.

Definition at line 305 of file svm_wrapper.h.

References training_set_.

◆ setParameters()

void pcl::SVMTrain::setParameters ( SVMParam param)
inline

Change default training parameters (pcl::SVMParam).

Definition at line 284 of file svm_wrapper.h.

References param_.

◆ trainClassifier()

bool pcl::SVMTrain::trainClassifier ( )

Start the training of the SVM classifier.

Returns
false if fails

Member Data Documentation

◆ class_name_

std::string pcl::SVM::class_name_
protected

Definition at line 130 of file svm_wrapper.h.

Referenced by SVMTrain().

◆ cross_validation_

int pcl::SVMTrain::cross_validation_ {0}
protected

Set too 1 for cross validating the classifier.

Definition at line 250 of file svm_wrapper.h.

◆ debug_

bool pcl::SVMTrain::debug_ {false}
protected

Set to 1 to see the training output.

Definition at line 248 of file svm_wrapper.h.

Referenced by setDebugMode().

◆ labelled_training_set_

Definition at line 134 of file svm_wrapper.h.

◆ line_

char* pcl::SVM::line_
protected

Definition at line 132 of file svm_wrapper.h.

◆ max_line_len_

int pcl::SVM::max_line_len_
protected

Definition at line 133 of file svm_wrapper.h.

◆ model_

Definition at line 126 of file svm_wrapper.h.

Referenced by getClassifierModel(), and ~SVMTrain().

◆ nr_fold_

int pcl::SVMTrain::nr_fold_ {0}
protected

Number of folds to be used during cross validation.

It indicates in how many parts is split the input training set.

Definition at line 253 of file svm_wrapper.h.

◆ param_

Definition at line 129 of file svm_wrapper.h.

Referenced by getParameters(), and setParameters().

◆ prob_

Definition at line 125 of file svm_wrapper.h.

Referenced by loadProblem(), and saveNormTrainingSet().

◆ scaling_

Definition at line 127 of file svm_wrapper.h.

◆ training_set_

std::vector<SVMData> pcl::SVM::training_set_
protected

Definition at line 124 of file svm_wrapper.h.

Referenced by getInputTrainingSet(), resetTrainingSet(), and setInputTrainingSet().


The documentation for this class was generated from the following file: