Classes | |
struct | ClassInfo |
Public Member Functions | |
Bayes (uint numFeatures, uint numClasses) | |
~Bayes () | |
Destructor. | |
void | learn (const std::vector< double > &fv, const uint cls) |
Learn to associate a feature vector with a particuler class. | |
void | learn (const std::vector< double > &fv, const char *name) |
Learn to associate a feature vector with a particuler class name. | |
int | classify (const std::vector< double > &fv, double *prob=NULL) |
classify a given feature vector | |
std::vector< ClassInfo > | classifyRange (std::vector< double > &fv, int &retCls, const bool sort=true) |
classify a given feature vector (Return all classes and thier prob, cls contains the max) | |
std::vector< double > | getClassProb (const std::vector< double > &fv) |
Return the probability of all the classes given the feature vector. | |
double | getMean (const uint cls, const uint i) const |
Get the mean for a particuler feature. | |
double | getStdevSq (const uint cls, const uint i) const |
Get the stdev Squared for a particuler feature. | |
void | setMean (const uint cls, const uint i, const double val) |
set the mean | |
void | setStdevSq (const uint cls, const uint i, const double val) |
set the stdev Squared for a particuler feature | |
uint | getNumFeatures () const |
Get the number of features. | |
uint | getNumClasses () const |
Get the number of classes. | |
uint | getClassFreq (const uint cls) const |
Get the Freq of a given class. | |
double | getClassProb (const uint cls) const |
Get the probability of a given class. | |
double | getStatSig (const std::vector< double > &fv, const uint cls) const |
return the statistical significent of the FV for a given class | |
double | gauss (const double x, const double mean, const double stdevSq) const |
Calculate a Normal Dist (use the srdev squared. | |
void | save (const char *filename) |
Save the network to a file. | |
bool | load (const char *filename) |
Load the network from a binary file. | |
void | import (const char *filename) |
Load the network from a text file. | |
void | setFeatureName (uint index, const char *name) |
set feature name (for debuging) | |
const char * | getFeatureName (const uint index) const |
get feature name (for debuging) | |
int | addClass (const char *name) |
Add class by name and return its Id. | |
const char * | getClassName (const uint id) |
Get the class name from a given Id. | |
int | getClassId (const char *name) |
Get the class id from a given name. | |
double | getMaxProb () const |
get the probability value associated with a classification | |
double | getNormProb () const |
get the normalized probability value associated with a classification |
Definition at line 46 of file Bayes.H.
int Bayes::addClass | ( | const char * | name | ) |
Add class by name and return its Id.
Definition at line 561 of file Bayes.C.
References getClassId().
Referenced by learn().
int Bayes::classify | ( | const std::vector< double > & | fv, | |
double * | prob = NULL | |||
) |
std::vector< Bayes::ClassInfo > Bayes::classifyRange | ( | std::vector< double > & | fv, | |
int & | retCls, | |||
const bool | sort = true | |||
) |
double Bayes::gauss | ( | const double | x, | |
const double | mean, | |||
const double | stdevSq | |||
) | const [inline] |
Calculate a Normal Dist (use the srdev squared.
Definition at line 396 of file Bayes.C.
Referenced by classify(), classifyRange(), and getClassProb().
int Bayes::getClassId | ( | const char * | name | ) |
Get the class id from a given name.
Definition at line 589 of file Bayes.C.
Referenced by addClass(), SceneUnderstanding::biasFor(), and learn().
const char * Bayes::getClassName | ( | const uint | id | ) |
Get the class name from a given Id.
Definition at line 581 of file Bayes.C.
References ASSERT.
Referenced by SceneUnderstanding::highOrderRec().
double Bayes::getClassProb | ( | const uint | cls | ) | const |
std::vector< double > Bayes::getClassProb | ( | const std::vector< double > & | fv | ) |
const char * Bayes::getFeatureName | ( | const uint | index | ) | const |
double Bayes::getMaxProb | ( | ) | const |
Get the mean for a particuler feature.
Definition at line 189 of file Bayes.C.
References ASSERT.
Referenced by cMapLeftBiasProc().
double Bayes::getNormProb | ( | ) | const |
uint Bayes::getNumClasses | ( | ) | const |
uint Bayes::getNumFeatures | ( | ) | const |
double Bayes::getStatSig | ( | const std::vector< double > & | fv, | |
const uint | cls | |||
) | const |
return the statistical significent of the FV for a given class
Definition at line 373 of file Bayes.C.
Referenced by classifyRange().
Get the stdev Squared for a particuler feature.
Definition at line 196 of file Bayes.C.
References ASSERT.
Referenced by cMapLeftBiasProc().
void Bayes::import | ( | const char * | filename | ) |
void Bayes::learn | ( | const std::vector< double > & | fv, | |
const char * | name | |||
) |
Learn to associate a feature vector with a particuler class name.
Definition at line 101 of file Bayes.C.
References addClass(), ASSERT, and getClassId().
void Bayes::learn | ( | const std::vector< double > & | fv, | |
const uint | cls | |||
) |
Learn to associate a feature vector with a particuler class.
Definition at line 75 of file Bayes.C.
References ASSERT.
Referenced by SceneUnderstanding::learn().
bool Bayes::load | ( | const char * | filename | ) |
void Bayes::save | ( | const char * | filename | ) |
void Bayes::setFeatureName | ( | uint | index, | |
const char * | name | |||
) |