Loading...
Searching...
No Matches
pcl::SVM Class Reference

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

`#include <pcl/ml/svm_wrapper.h>`

Inheritance diagram for pcl::SVM:

## Public Member Functions

| 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

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.

## Static Protected Member Functions

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

## Protected Attributes

std::vector< SVMData > | training_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 121 of file svm_wrapper.h.

## Constructor & Destructor Documentation

## SVM()

pcl::SVM::SVM | ( |  | ) |

inline

Constructor.

Definition at line 181 of file svm_wrapper.h.

## ~SVM()

pcl::SVM::~SVM | ( |  | ) |

inline

Destructor.

Definition at line 184 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 | ) |

inline protected

Outputs an error in file reading.

Definition at line 146 of file svm_wrapper.h.

## getClassName()

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

inline protected

Get a string representation of the name of this class.

Definition at line 154 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 200 of file svm_wrapper.h.

References model_.

## loadProblem()

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

protected

Load a problem from an extern file.

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

## printNull()

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

inline static protected

Set for output printings during classification.

Definition at line 138 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 214 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 129 of file svm_wrapper.h.

Referenced by getClassName().

## labelled_training_set_

bool pcl::SVM::labelled_training_set_

protected

Initial value:
{
true}

Definition at line 133 of file svm_wrapper.h.

## line_

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

protected

Definition at line 131 of file svm_wrapper.h.

## max_line_len_

int pcl::SVM::max_line_len_ {10000}

protected

Definition at line 132 of file svm_wrapper.h.

## model_

SVMModel pcl::SVM::model_

protected

Definition at line 125 of file svm_wrapper.h.

Referenced by getLabel(), and saveClassifierModel().

## param_

SVMParam pcl::SVM::param_

protected

Definition at line 128 of file svm_wrapper.h.

Referenced by ~SVM().

## prob_

svm_problem pcl::SVM::prob_

protected

Definition at line 124 of file svm_wrapper.h.

Referenced by ~SVM().

## scaling_

svm_scaling pcl::SVM::scaling_

protected

Definition at line 126 of file svm_wrapper.h.

Referenced by ~SVM().

## training_set_

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

protected

Definition at line 123 of file svm_wrapper.h.

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

- pcl/ml/svm_wrapper.h