TimeSlot.h

00001 #ifndef TIMESLOT_H
00002 #define TIMESLOT_H
00003 
00004 #include <vector>
00005 #include <string>
00006 #include <map>
00007 
00008 #include "HMMLib.h"
00009 #include "Quantizer.h"
00010 
00011 using namespace std;
00012 
00013 namespace WiimoteGR{
00014     struct HMM;
00015     class Quantizer;
00016     /*
00017         TimeSlot:
00018     */
00019     struct TimeSlot{
00020     public:
00021         string gestureName;
00022         string quantizerName;
00023         //number of observation symbols, it should match with the related HMM
00024         size_t M;
00025 
00026         //observable symbol sequence
00027         vector<size_t> o; //vector size: T
00028 
00029         //for probability computation(for training, too)
00030         //mapping HMM to prob computation vectors and result
00031         map< const HMM*,vector< vector<double> > > alpha; //vector size: T*N
00032         map< const HMM*,vector<double> > scale; //vector size: T
00033         map< const HMM*,double > logProb;//P(O|HMM)
00034 
00035         //for HMM training, empty if not used
00036         //no mapping because training is usually done once, and for one HMM
00037         vector< vector<double> > beta, gamma; //vector size: T*N
00038         vector< vector< vector<double> > > xi; //vector size T*N*N
00039 
00040         void AddObservableSymbol(size_t obsSymbol){
00041             o.push_back(obsSymbol);
00042         }
00043         void ClearObservableSymbols(){
00044             o.clear();
00045             alpha.clear();
00046             scale.clear();
00047             logProb.clear();
00048         }
00049 
00050         TimeSlot(const char* gestureName, const Quantizer& quantizer)
00051             :gestureName(gestureName), quantizerName(quantizer.name), M(quantizer.M)
00052         {
00053         
00054         }
00055     };
00056 }
00057 
00058 #endif
Generated on Sun May 8 08:40:59 2011 for iLab Neuromorphic Vision Toolkit by  doxygen 1.6.3