Multi-Class Gentle-AdaBoost using a One vs All, MAX wins voting scheme. More...
#include <Learn/GentleBoost.H>
Public Member Functions | |
GentleBoost (int maxTreeSize=1) | |
std::map< int, std::vector < float > > | predictPDF (const std::vector< std::vector< float > > &data) |
Get PDF map of each class, with a vector of each observation. | |
int | getMostLikelyClass (const std::map< int, std::vector< float > > &pdf, int index) |
Get the most likely class for a particular index in a set of observations. | |
std::vector< int > | getMostLikelyClass (const std::map< int, std::vector< float > > &pdf) |
Get the most likely class for a set of observations. | |
std::vector< int > | predict (const std::vector< std::vector< float > > &data) |
Get most likely class per observation. | |
void | train (const std::vector< std::vector< float > > &data, const std::vector< int > &labels, int maxIters) |
Train a set of binary (1vsAll) GentleBoost classifiers on the given data. | |
std::map< int, std::vector< int > > | convertLabels (const std::vector< int > &labels) |
Convert class id labels to binary per class labels. | |
void | clear () |
Remove all training. | |
std::vector< std::vector< float > > | transpose (const std::vector< std::vector< float > > &data) |
Convenience function to transpose the data dimensions, since the ordering is unusual. | |
void | printAllTrees () |
Convenience function to print the underlying decision trees for each 1vsAll Classifier. | |
void | writeAllTrees (std::ostream &outstream) |
Create a string representation of the heirarchy. | |
void | readAllTrees (std::istream &instream) |
Read a string representation of the heirarchy and build the class. | |
void | load (std::string file) |
Load a BOOSTed system from a file. | |
void | save (std::string file) |
Save a BOOSTed system to a file. |
Multi-Class Gentle-AdaBoost using a One vs All, MAX wins voting scheme.
Definition at line 55 of file GentleBoost.H.
void GentleBoost::clear | ( | ) |
Remove all training.
std::map< int, std::vector< int > > GentleBoost::convertLabels | ( | const std::vector< int > & | labels | ) |
Convert class id labels to binary per class labels.
Convert per class labels to a set of binary +1/-1 labels for each class.
Definition at line 207 of file GentleBoost.C.
Referenced by train().
std::vector< int > GentleBoost::getMostLikelyClass | ( | const std::map< int, std::vector< float > > & | ) |
Get the most likely class for a set of observations.
Definition at line 100 of file GentleBoost.C.
References ASSERT, and getMostLikelyClass().
int GentleBoost::getMostLikelyClass | ( | const std::map< int, std::vector< float > > & | pdf, | |
int | index | |||
) |
Get the most likely class for a particular index in a set of observations.
Definition at line 81 of file GentleBoost.C.
References ASSERT.
Referenced by getMostLikelyClass(), and predict().
void GentleBoost::load | ( | std::string | file | ) |
Load a BOOSTed system from a file.
Definition at line 199 of file GentleBoost.C.
References in, and readAllTrees().
Referenced by GentleBoostComponent::start2().
std::vector< int > GentleBoost::predict | ( | const std::vector< std::vector< float > > & | data | ) |
Get most likely class per observation.
Definition at line 114 of file GentleBoost.C.
References getMostLikelyClass(), and predictPDF().
std::map< int, std::vector< float > > GentleBoost::predictPDF | ( | const std::vector< std::vector< float > > & | data | ) |
Get PDF map of each class, with a vector of each observation.
Definition at line 68 of file GentleBoost.C.
References ASSERT.
Referenced by predict().
void GentleBoost::printAllTrees | ( | ) |
Convenience function to print the underlying decision trees for each 1vsAll Classifier.
Definition at line 132 of file GentleBoost.C.
void GentleBoost::readAllTrees | ( | std::istream & | instream | ) |
Read a string representation of the heirarchy and build the class.
Definition at line 155 of file GentleBoost.C.
Referenced by load().
void GentleBoost::save | ( | std::string | file | ) |
Save a BOOSTed system to a file.
Definition at line 193 of file GentleBoost.C.
References writeAllTrees().
void GentleBoost::train | ( | const std::vector< std::vector< float > > & | data, | |
const std::vector< int > & | labels, | |||
int | maxIters | |||
) |
Train a set of binary (1vsAll) GentleBoost classifiers on the given data.
Definition at line 121 of file GentleBoost.C.
References convertLabels().
std::vector< std::vector< float > > GentleBoost::transpose | ( | const std::vector< std::vector< float > > & | data | ) |
Convenience function to transpose the data dimensions, since the ordering is unusual.
Definition at line 52 of file GentleBoost.C.
void GentleBoost::writeAllTrees | ( | std::ostream & | outstream | ) |
Create a string representation of the heirarchy.
Definition at line 142 of file GentleBoost.C.
References sformat().
Referenced by save().