Bayes Class Reference

Collaboration diagram for Bayes:
Collaboration graph
[legend]

List of all members.

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< ClassInfoclassifyRange (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

Detailed Description

Definition at line 46 of file Bayes.H.


Constructor & Destructor Documentation

Bayes::Bayes ( uint  numFeatures,
uint  numClasses 
)

Construct a bayes classifer with a given number of features and number of classes

Definition at line 59 of file Bayes.C.

Bayes::~Bayes (  ) 

Destructor.

Definition at line 71 of file Bayes.C.


Member Function Documentation

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 
)

classify a given feature vector

Definition at line 251 of file Bayes.C.

References exp(), gauss(), log(), and max().

Referenced by SceneUnderstanding::classifyFovea().

std::vector< Bayes::ClassInfo > Bayes::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)

Definition at line 300 of file Bayes.C.

References exp(), gauss(), getStatSig(), log(), and max().

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.

References exp(), and sqrt().

Referenced by classify(), classifyRange(), and getClassProb().

uint Bayes::getClassFreq ( const uint  cls  )  const

Get the Freq of a given class.

Definition at line 230 of file Bayes.C.

References ASSERT.

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

Get the probability of a given class.

Definition at line 237 of file Bayes.C.

References ASSERT.

std::vector< double > Bayes::getClassProb ( const std::vector< double > &  fv  ) 

Return the probability of all the classes given the feature vector.

Definition at line 343 of file Bayes.C.

References gauss(), and log().

const char * Bayes::getFeatureName ( const uint  index  )  const

get feature name (for debuging)

Definition at line 554 of file Bayes.C.

References ASSERT.

double Bayes::getMaxProb (  )  const

get the probability value associated with a classification

Definition at line 603 of file Bayes.C.

double Bayes::getMean ( const uint  cls,
const uint  i 
) 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

get the normalized probability value associated with a classification

Definition at line 607 of file Bayes.C.

uint Bayes::getNumClasses (  )  const

Get the number of classes.

Definition at line 224 of file Bayes.C.

uint Bayes::getNumFeatures (  )  const

Get the number of features.

Definition at line 218 of file Bayes.C.

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.

References ASSERT, and log().

Referenced by classifyRange().

double Bayes::getStdevSq ( const uint  cls,
const uint  i 
) const

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  ) 

Load the network from a text file.

Definition at line 499 of file Bayes.C.

References mean().

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  ) 

Load the network from a binary file.

Definition at line 444 of file Bayes.C.

void Bayes::save ( const char *  filename  ) 

Save the network to a file.

Definition at line 403 of file Bayes.C.

void Bayes::setFeatureName ( uint  index,
const char *  name 
)

set feature name (for debuging)

Definition at line 547 of file Bayes.C.

References ASSERT.

void Bayes::setMean ( const uint  cls,
const uint  i,
const double  val 
)

set the mean

Definition at line 203 of file Bayes.C.

References ASSERT.

void Bayes::setStdevSq ( const uint  cls,
const uint  i,
const double  val 
)

set the stdev Squared for a particuler feature

Definition at line 211 of file Bayes.C.

References ASSERT.


The documentation for this class was generated from the following files:
Generated on Sun May 8 08:43:07 2011 for iLab Neuromorphic Vision Toolkit by  doxygen 1.6.3