Point Cloud Library (PCL)  1.14.1-dev
List of all members | Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes
pcl::SVM Class Reference

Base class for SVM SVM (Support Vector Machines). More...

#include <pcl/ml/svm_wrapper.h>

+ Inheritance diagram for pcl::SVM:
+ Collaboration diagram for pcl::SVM:

Public Member Functions

 SVM ()
 Constructor. More...
 
 ~SVM ()
 Destructor. More...
 
void getLabel (std::vector< int > &labels)
 Return the labels order from the classifier model. More...
 
void saveClassifierModel (const char *filename)
 Save the classifier model in an extern file (in svmlight format). More...
 

Protected Member Functions

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

Static Protected Member Functions

static void printNull (const char *)
 Set for output printings during classification. More...
 

Protected Attributes

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_
 

Detailed Description

Base class for SVM SVM (Support Vector Machines).

Definition at line 122 of file svm_wrapper.h.

Constructor & Destructor Documentation

◆ SVM()

pcl::SVM::SVM ( )
inline

Constructor.

Definition at line 182 of file svm_wrapper.h.

◆ ~SVM()

pcl::SVM::~SVM ( )
inline

Destructor.

Definition at line 185 of file svm_wrapper.h.

References svm_problem::l, svm_scaling::max, svm_scaling::obj, param_, prob_, scaling_, svm_problem::x, and svm_problem::y.

Member Function Documentation

◆ adaptInputToLibSVM()

void pcl::SVM::adaptInputToLibSVM ( std::vector< SVMData training_set,
svm_problem prob 
)
protected

Convert the input format (vector of SVMData) into a readable format for libSVM.

Referenced by pcl::SVMClassify::setInputTrainingSet().

◆ adaptLibSVMToInput()

void pcl::SVM::adaptLibSVMToInput ( std::vector< SVMData > &  training_set,
svm_problem  prob 
) const
protected

Convert the libSVM format (svm_problem) into a easier output format.

Referenced by pcl::SVMClassify::loadClassProblem(), and pcl::SVMClassify::loadNormClassProblem().

◆ exitInputError()

void pcl::SVM::exitInputError ( int  line_num)
inlineprotected

Outputs an error in file reading.

Definition at line 147 of file svm_wrapper.h.

◆ getClassName()

const std::string& pcl::SVM::getClassName ( ) const
inlineprotected

Get a string representation of the name of this class.

Definition at line 155 of file svm_wrapper.h.

References class_name_.

Referenced by pcl::SVMClassify::setInputTrainingSet().

◆ getLabel()

void pcl::SVM::getLabel ( std::vector< int > &  labels)
inline

Return the labels order from the classifier model.

Definition at line 201 of file svm_wrapper.h.

References model_.

◆ loadProblem()

bool pcl::SVM::loadProblem ( const char *  filename,
svm_problem prob 
)
protected

◆ printNull()

static void pcl::SVM::printNull ( const char *  )
inlinestaticprotected

Set for output printings during classification.

Definition at line 139 of file svm_wrapper.h.

Referenced by pcl::SVMTrain::setDebugMode(), and pcl::SVMTrain::SVMTrain().

◆ readline()

char* pcl::SVM::readline ( FILE *  input)
protected

To read a line from the input file.

Stored in "line_".

◆ saveClassifierModel()

void pcl::SVM::saveClassifierModel ( const char *  filename)
inline

Save the classifier model in an extern file (in svmlight format).

Definition at line 215 of file svm_wrapper.h.

References svm_model::l, and model_.

◆ saveProblem()

bool pcl::SVM::saveProblem ( const char *  filename,
bool  labelled 
)
protected

Save the raw problem in an extern file.

Referenced by pcl::SVMClassify::saveClassProblem(), and pcl::SVMTrain::saveTrainingSet().

◆ saveProblemNorm()

bool pcl::SVM::saveProblemNorm ( const char *  filename,
svm_problem  prob_,
bool  labelled 
)
protected

Save the problem (with normalized values) in an extern file.

Referenced by pcl::SVMClassify::saveNormClassProblem(), and pcl::SVMTrain::saveNormTrainingSet().

Member Data Documentation

◆ class_name_

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

Definition at line 130 of file svm_wrapper.h.

Referenced by getClassName().

◆ labelled_training_set_

bool pcl::SVM::labelled_training_set_
protected
Initial value:
{
true}

Definition at line 134 of file svm_wrapper.h.

◆ line_

char* pcl::SVM::line_ {nullptr}
protected

Definition at line 132 of file svm_wrapper.h.

◆ max_line_len_

int pcl::SVM::max_line_len_ {10000}
protected

Definition at line 133 of file svm_wrapper.h.

◆ model_

SVMModel pcl::SVM::model_
protected

Definition at line 126 of file svm_wrapper.h.

Referenced by getLabel(), and saveClassifierModel().

◆ param_

SVMParam pcl::SVM::param_
protected

Definition at line 129 of file svm_wrapper.h.

Referenced by ~SVM().

◆ prob_

svm_problem pcl::SVM::prob_
protected

Definition at line 125 of file svm_wrapper.h.

Referenced by ~SVM().

◆ scaling_

svm_scaling pcl::SVM::scaling_
protected

Definition at line 127 of file svm_wrapper.h.

Referenced by ~SVM().

◆ training_set_

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

Definition at line 124 of file svm_wrapper.h.


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