HMM.h

Go to the documentation of this file.
00001 
00024 #ifndef _HMM_H
00025 #define _HMM_H
00026 
00027 #include "../Predictor.h"
00028 #define HAVE_NAMESPACES
00029 #include <ghmm++/GHMM.h>
00030 #include <ghmm++/GHMM_DiscreteModel.h>
00031 
00035 class HMM : public PredictorAlgorithm {
00036         private:
00038 
00042                 //unsigned int windowLength;
00043                  
00044                 unsigned int numHiddenStates;
00045                 unsigned int numAlphabetSymbols;
00046                 GHMM_DiscreteModel* hmm;
00047 
00048                 //list<unsigned long> curContextWindow;
00049                 list<unsigned long> seenContexts;
00050 
00051         public:
00052                 HMM(predictorparams &params);
00053                 // test contructor !
00054                 HMM(unsigned int numHiddenStates, unsigned int numAlphabetSymbols);
00056                 virtual ~HMM();
00057 
00058                 virtual void addContexts(const membershiplist* contexts, time_t time);
00059                 virtual void addContext(unsigned long contextId, time_t time);
00060 
00061                 virtual unsigned long getNextContext() const;
00062                 virtual membershiplist getNextContexts() const;
00063 
00064                 virtual contexttrajectory getContextTrajectory(unsigned int start, unsigned int end) const;
00065 
00066                 virtual unsigned long getContextAt(time_t time) const;
00067                 virtual membershiplist getContextsAt(time_t time) const;
00068 
00069                 virtual string serialize() const;
00070                 virtual void unserialize(string data);
00071                 
00073                 // have to specify sliding windows size ! 
00074                 // this trains the hmm with more than one sequences of length slidingWindowSize with an offset of slidingWindowHops
00075                 void addContextTrajectory(const vector<unsigned int>& traj, unsigned int from, unsigned int to, unsigned int slidingWindowSize, unsigned int slidingWindowHops);
00076                 unsigned long getNextContext(const vector<unsigned int>& window) const;
00077                 vector<unsigned long> getNextContextsMultiStep(const vector<unsigned int>& window, unsigned int numSteps) const;
00078                 virtual membershiplist getNextContexts(const vector<unsigned int>& window) const;
00079 
00080 #if _DEBUG_PREDICTORS
00081                 virtual string toString() const;
00082 #endif
00083 };
00084 
00085 #endif

Generated on Mon Jun 5 10:20:42 2006 for Intelligence.kdevelop by  doxygen 1.4.6