Public Types | |
typedef std::map< int, std::vector< std::vector < float > > > | MapModelVector |
Public Member Functions | |
LogLikelihoodClassifier (int k=5) | |
float | calcLogLikelihood (const std::vector< float > &sample, const std::vector< float > &model) |
Calculate log likelihood probability for this sample and model. | |
void | addModel (std::vector< float > hist, int id) |
Add a model exemplar for this id (ok to have multiple exemplars per class). | |
void | setModels (MapModelVector models) |
Set the models that will be used for this classifier. | |
MapModelVector | getModels () |
Return the models that were used for this classifier. | |
int | predict (const std::vector< float > &hist) |
Predict using classifier. | |
std::map< int, double > | predictPDF (const std::vector< float > &hist) |
Predict using classifier and return the full PDF across classes. | |
void | nearestNeighborVotePDF (const std::map< int, std::list< float > > &logLikelihood, std::map< int, double > &pdf) |
Perform k-nearest neighbor vote that does a short circuited calculation using the best likelihoods to calculate the full PDF. | |
uint | getNumModels () |
Get number of models. | |
Protected Attributes | |
MapModelVector | itsModels |
Store a list of model histograms for each model id. | |
uint | itsHistLength |
uint | itsK |
Definition at line 46 of file LogLikelihoodClassifier.H.
void LogLikelihoodClassifier::addModel | ( | std::vector< float > | hist, | |
int | id | |||
) |
Add a model exemplar for this id (ok to have multiple exemplars per class).
Definition at line 70 of file LogLikelihoodClassifier.C.
float LogLikelihoodClassifier::calcLogLikelihood | ( | const std::vector< float > & | sample, | |
const std::vector< float > & | model | |||
) |
Calculate log likelihood probability for this sample and model.
Definition at line 56 of file LogLikelihoodClassifier.C.
Referenced by predictPDF().
LogLikelihoodClassifier::MapModelVector LogLikelihoodClassifier::getModels | ( | ) |
Return the models that were used for this classifier.
Definition at line 86 of file LogLikelihoodClassifier.C.
References itsModels.
uint LogLikelihoodClassifier::getNumModels | ( | ) |
Get number of models.
Definition at line 227 of file LogLikelihoodClassifier.C.
References itsModels.
void LogLikelihoodClassifier::nearestNeighborVotePDF | ( | const std::map< int, std::list< float > > & | logLikelihood, | |
std::map< int, double > & | ||||
) |
Perform k-nearest neighbor vote that does a short circuited calculation using the best likelihoods to calculate the full PDF.
Definition at line 191 of file LogLikelihoodClassifier.C.
Referenced by predictPDF().
int LogLikelihoodClassifier::predict | ( | const std::vector< float > & | hist | ) |
Predict using classifier.
Definition at line 92 of file LogLikelihoodClassifier.C.
References max(), and predictPDF().
std::map< int, double > LogLikelihoodClassifier::predictPDF | ( | const std::vector< float > & | hist | ) |
Predict using classifier and return the full PDF across classes.
Definition at line 110 of file LogLikelihoodClassifier.C.
References ASSERT, calcLogLikelihood(), itsModels, max(), and nearestNeighborVotePDF().
Referenced by predict().
void LogLikelihoodClassifier::setModels | ( | MapModelVector | models | ) |
Set the models that will be used for this classifier.
Definition at line 81 of file LogLikelihoodClassifier.C.
References itsModels.
MapModelVector LogLikelihoodClassifier::itsModels [protected] |
Store a list of model histograms for each model id.
Definition at line 81 of file LogLikelihoodClassifier.H.
Referenced by addModel(), getModels(), getNumModels(), predictPDF(), and setModels().