pcl::SVMClassify Class Reference

SVM (Support Vector Machines) classification of a dataset. More...

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

Inheritance diagram for pcl::SVMClassify:

## Public Member Functions

| SVMClassify ()
| Constructor. More...
| ~SVMClassify ()
| Destructor. More...
void | setInputTrainingSet (std::vector< SVMData > training_set)
| It adds/store the training set with labelled data. More...
std::vector< SVMData > | getInputTrainingSet ()
| Return the current training set. More...
void | resetTrainingSet ()
| Reset the training set. More...
bool | loadClassifierModel (const char *filename)
| Read in a classifier model (in svmlight format). More...
void | getClassificationResult (std::vector< std::vector< double >> &out)
| Get the result of the classification. More...
void | saveClassificationResult (const char *filename)
| Save the classification result in an extern file. More...
void | setClassifierModel (SVMModel model)
| Set the classifier model. More...
bool | loadClassProblem (const char *filename)
| Read in a raw classification problem (in svmlight format). More...
bool | loadNormClassProblem (const char *filename)
| Read in a normalized classification problem (in svmlight format). More...
void | setProbabilityEstimates (bool set)
| Set whether the classification has to be done with the probability estimate. More...
bool | classificationTest ()
| Start the classification on labelled input dataset. More...
bool | classification ()
| Start the classification on un-labelled input dataset. More...
std::vector< double > | classification (SVMData in)
| Start the classification on a single set. More...
bool | saveClassProblem (const char *filename)
| Save the raw classification problem in a file (in svmlight format). More...
bool | saveNormClassProblem (const char *filename)
| Save the normalized classification problem in a file (in svmlight format). More...
Public Member Functions inherited from pcl::SVM
| 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

void | scaleProblem (svm_problem &input, svm_scaling scaling)
| It scales the input dataset using the model information. More...
Protected Member Functions inherited from pcl::SVM
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)
| 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...

## Protected Attributes

bool | model_extern_copied_
bool | predict_probability_
std::vector< std::vector< double > > | prediction_
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< SVMData > | training_set_
Protected Attributes inherited from pcl::SVM
std::vector< SVMData > | training_set_
svm_problem | prob_
SVMModel | model_
svm_scaling | scaling_
SVMParam | param_
std::string | class_name_
char * | line_
int | max_line_len_
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. More...

## Detailed Description

SVM (Support Vector Machines) classification of a dataset.

It can be used both for testing a classifier model and for classify of new data.

Definition at line 378 of file svm_wrapper.h.

## Constructor & Destructor Documentation

## SVMClassify()

pcl::SVMClassify::SVMClassify | ( |  | ) |

inline

Constructor.

Definition at line 400 of file svm_wrapper.h.

References pcl::SVM::class_name_.

## ~SVMClassify()

pcl::SVMClassify::~SVMClassify | ( |  | ) |

inline

Destructor.

Definition at line 406 of file svm_wrapper.h.

References svm_model::l, pcl::SVM::model_, and model_extern_copied_.

## Member Function Documentation

## classification() [1/2]

bool pcl::SVMClassify::classification | ( |  | ) |

Start the classification on un-labelled input dataset.

To get the classification result, use getClassificationResult().

Returns
  false if fails

## classification() [2/2]

std::vector<double> pcl::SVMClassify::classification | ( | SVMData | in | ) |

Start the classification on a single set.

## classificationTest()

bool pcl::SVMClassify::classificationTest | ( |  | ) |

Start the classification on labelled input dataset.

It returns the accuracy percentage. To get the classification result, use getClassificationResult().

Returns
  false if fails

## getClassificationResult()

void pcl::SVMClassify::getClassificationResult | ( | std::vector< std::vector< double >> & | out | ) |

inline

Get the result of the classification.

Definition at line 452 of file svm_wrapper.h.

References prediction_.

## getInputTrainingSet()

std::vector<SVMData> pcl::SVMClassify::getInputTrainingSet | ( |  | ) |

inline

Return the current training set.

Definition at line 431 of file svm_wrapper.h.

References pcl::SVM::training_set_.

## loadClassifierModel()

bool pcl::SVMClassify::loadClassifierModel | ( | const char * | filename | ) |

Read in a classifier model (in svmlight format).

Returns
  false if fails

## loadClassProblem()

bool pcl::SVMClassify::loadClassProblem | ( | const char * | filename | ) |

inline

Read in a raw classification problem (in svmlight format).

The values are normalized using the classifier model information.

Returns
  false if fails

Definition at line 492 of file svm_wrapper.h.

References pcl::SVM::adaptLibSVMToInput(), svm_model::l, pcl::SVM::loadProblem(), pcl::SVM::model_, pcl::SVM::prob_, scaleProblem(), pcl::SVM::scaling_, and pcl::SVM::training_set_.

## loadNormClassProblem()

bool pcl::SVMClassify::loadNormClassProblem | ( | const char * | filename | ) |

inline

Read in a normalized classification problem (in svmlight format).

The data are kept whitout normalizing.

Returns
  false if fails

Definition at line 509 of file svm_wrapper.h.

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

## resetTrainingSet()

void pcl::SVMClassify::resetTrainingSet | ( |  | ) |

inline

Reset the training set.

Definition at line 438 of file svm_wrapper.h.

References pcl::SVM::training_set_.

## saveClassificationResult()

void pcl::SVMClassify::saveClassificationResult | ( | const char * | filename | ) |

Save the classification result in an extern file.

## saveClassProblem()

bool pcl::SVMClassify::saveClassProblem | ( | const char * | filename | ) |

inline

Save the raw classification problem in a file (in svmlight format).

Returns
  false if fails

Definition at line 552 of file svm_wrapper.h.

References pcl::SVM::saveProblem().

## saveNormClassProblem()

bool pcl::SVMClassify::saveNormClassProblem | ( | const char * | filename | ) |

inline

Save the normalized classification problem in a file (in svmlight format).

Returns
  false if fails

Definition at line 562 of file svm_wrapper.h.

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

## scaleProblem()

void pcl::SVMClassify::scaleProblem | ( | svm_problem & | input,
|  | svm_scaling | scaling
| ) |  |

protected

It scales the input dataset using the model information.

Referenced by loadClassProblem().

## setClassifierModel()

void pcl::SVMClassify::setClassifierModel | ( | SVMModel | model | ) |

inline

Set the classifier model.

Definition at line 464 of file svm_wrapper.h.

References svm_node::index, svm_scaling::max, pcl::SVM::model_, model_extern_copied_, svm_scaling::obj, svm_model::scaling, and pcl::SVM::scaling_.

## setInputTrainingSet()

void pcl::SVMClassify::setInputTrainingSet | ( | std::vector< SVMData > | training_set | ) |

inline

It adds/store the training set with labelled data.

Definition at line 414 of file svm_wrapper.h.

References pcl::SVM::adaptInputToLibSVM(), pcl::SVM::getClassName(), svm_scaling::max, pcl::SVM::prob_, pcl::SVM::scaling_, and pcl::SVM::training_set_.

## setProbabilityEstimates()

void pcl::SVMClassify::setProbabilityEstimates | ( | bool | set | ) |

inline

Set whether the classification has to be done with the probability estimate.

(The classifier model has to support it).

Definition at line 519 of file svm_wrapper.h.

References predict_probability_.

## Member Data Documentation

## class_name_

std::string pcl::SVM::class_name_

protected

Definition at line 131 of file svm_wrapper.h.

## labelled_training_set_

bool pcl::SVM::labelled_training_set_

protected

Definition at line 135 of file svm_wrapper.h.

## line_

char* pcl::SVM::line_

protected

Definition at line 133 of file svm_wrapper.h.

## max_line_len_

int pcl::SVM::max_line_len_

protected

Definition at line 134 of file svm_wrapper.h.

## model_

SVMModel pcl::SVM::model_

protected

Definition at line 127 of file svm_wrapper.h.

## model_extern_copied_

bool pcl::SVMClassify::model_extern_copied_

protected

Definition at line 390 of file svm_wrapper.h.

Referenced by setClassifierModel(), and ~SVMClassify().

## param_

SVMParam pcl::SVM::param_

protected

Definition at line 130 of file svm_wrapper.h.

## predict_probability_

bool pcl::SVMClassify::predict_probability_

protected

Definition at line 391 of file svm_wrapper.h.

Referenced by setProbabilityEstimates().

## prediction_

std::vector<std::vector<double> > pcl::SVMClassify::prediction_

protected

Definition at line 392 of file svm_wrapper.h.

Referenced by getClassificationResult().

## prob_

svm_problem pcl::SVM::prob_

protected

Definition at line 126 of file svm_wrapper.h.

## scaling_

svm_scaling pcl::SVM::scaling_

protected

Definition at line 128 of file svm_wrapper.h.

## training_set_

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

protected

Definition at line 125 of file svm_wrapper.h.

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

- pcl/ml/svm_wrapper.h