SVM Classifier Class. More...
#include <Learn/SVMClassifier.H>
Public Member Functions | |
SVMClassifier (float gamma=0.00078125, int C=32) | |
Constructor. | |
~SVMClassifier () | |
Destructor. | |
void | train (std::string outputFileName, int id, std::vector< float > &feature) |
Train. | |
void | train (std::string outputFileName, int id, float *&feature, unsigned int fdim) |
void | train (std::string outputFilename, int id, float **&feature, unsigned int fdim1, unsigned int fdim2) |
void | train (Image< double > trainingData, std::vector< double > dataClasses) |
Train the SVM using the data in trainingData, with the ground truth data in dataClasses. | |
void | train (std::vector< std::vector< float > > trainingDta, std::vector< float > dataClasses) |
std::map< int, double > | predictPDF (const svm_node *dataPointNodes) |
Predict the class of a data point. | |
std::map< int, double > | predictPDF (std::vector< float > &feature) |
double | predict (Image< double > dataPoint, double *probability=NULL) |
Predict. | |
double | predict (std::vector< float > &feature, double *probability=NULL) |
double | predict (float *&feature, unsigned int fdim, double *probability=NULL) |
double | predict (float **&feature, unsigned int fdim1, unsigned int fdim2, double *probability=NULL) |
void | readModel (std::string modelFileName) |
void | writeModel (std::string modelFileName) |
Read model file into memory. | |
void | readRange (std::string rangeFileName) |
Write model file into memory. | |
float | rescaleValue (float value, unsigned int index) |
Read a range file to scale the feature vector, if needed. | |
Protected Member Functions | |
int | _getBestLabel (std::map< int, double > pdf, double *probability) |
If range is enabled, rescale the value to. | |
double | _predict (struct svm_node *node, unsigned int fdim, double *probability) |
void | _train (svm_problem &trainingProblem) |
Protected Attributes | |
struct svm_parameter | itsSVMParams |
struct svm_model * | itsSVMModel |
bool | itsSVMRangeEnabled |
std::vector< double > | itsSVMFeatureRangeMax |
std::vector< double > | itsSVMFeatureRangeMin |
double | itsSVMFeatureRangeUpper |
double | itsSVMFeatureRangeLower |
SVM Classifier Class.
Definition at line 53 of file SVMClassifier.H.
SVMClassifier::SVMClassifier | ( | float | gamma = 0.00078125 , |
|
int | C = 32 | |||
) |
Constructor.
Definition at line 52 of file SVMClassifier.C.
SVMClassifier::~SVMClassifier | ( | ) |
Destructor.
Definition at line 75 of file SVMClassifier.C.
int SVMClassifier::_getBestLabel | ( | std::map< int, double > | pdf, | |
double * | probability | |||
) | [protected] |
If range is enabled, rescale the value to.
Definition at line 297 of file SVMClassifier.C.
Referenced by predict().
double SVMClassifier::predict | ( | Image< double > | dataPoint, | |
double * | probability = NULL | |||
) |
Predict.
Definition at line 267 of file SVMClassifier.C.
References _getBestLabel(), ASSERT, Image< T >::getHeight(), Image< T >::getVal(), Image< T >::getWidth(), predictPDF(), and rescaleValue().
Predict the class of a data point.
Definition at line 248 of file SVMClassifier.C.
Referenced by predict().
void SVMClassifier::readRange | ( | std::string | rangeFileName | ) |
Write model file into memory.
Definition at line 87 of file SVMClassifier.C.
Referenced by SVMClassifierModule::start2().
float SVMClassifier::rescaleValue | ( | float | value, | |
unsigned int | index | |||
) |
Read a range file to scale the feature vector, if needed.
Definition at line 150 of file SVMClassifier.C.
Referenced by predict().
void SVMClassifier::train | ( | Image< double > | trainingData, | |
std::vector< double > | dataClasses | |||
) |
Train the SVM using the data in trainingData, with the ground truth data in dataClasses.
Definition at line 373 of file SVMClassifier.C.
References ASSERT, Image< T >::getHeight(), Image< T >::getVal(), and Image< T >::getWidth().
void SVMClassifier::train | ( | std::string | outputFileName, | |
int | id, | |||
std::vector< float > & | feature | |||
) |
Train.
Definition at line 316 of file SVMClassifier.C.
void SVMClassifier::writeModel | ( | std::string | modelFileName | ) |
Read model file into memory.
Definition at line 145 of file SVMClassifier.C.