Mercurial > hg > pyin
comparison SparseHMM.h @ 130:080fe18f5ebf fixedlag
refactored Viterbi
* perhaps I even discovered a bug (probablity sum was not reset for every frame)
author | Matthias Mauch <mail@matthiasmauch.net> |
---|---|
date | Fri, 03 Jul 2015 12:22:44 +0100 |
parents | 5945b8905d1f |
children | b877df85ad9e |
comparison
equal
deleted
inserted
replaced
129:72b3892c1d51 | 130:080fe18f5ebf |
---|---|
13 | 13 |
14 #ifndef _SPARSEHMM_H_ | 14 #ifndef _SPARSEHMM_H_ |
15 #define _SPARSEHMM_H_ | 15 #define _SPARSEHMM_H_ |
16 | 16 |
17 #include <vector> | 17 #include <vector> |
18 #include <queue> | |
18 #include <cstdio> | 19 #include <cstdio> |
19 | 20 |
20 using std::vector; | 21 using std::vector; |
22 using std::deque; | |
21 using std::pair; | 23 using std::pair; |
22 | 24 |
23 class SparseHMM | 25 class SparseHMM |
24 { | 26 { |
25 public: | 27 public: |
26 virtual const std::vector<double> calculateObsProb(const vector<pair<double, double> >); | 28 SparseHMM(); |
27 const std::vector<int> decodeViterbi(std::vector<vector<double> > obs, | 29 virtual const std::vector<double> |
28 vector<double> *scale); | 30 calculateObsProb(const vector<pair<double, double> >); |
29 vector<double> init; | 31 virtual void build(); |
30 vector<size_t> from; | 32 const std::vector<int> decodeViterbi(std::vector<vector<double> > obs); |
31 vector<size_t> to; | 33 void initialise(vector<double> firstObs); |
32 vector<double> transProb; | 34 int process(vector<double> newObs); |
35 vector<int> finalise(); | |
36 // "sparse" HMM definition | |
37 int m_nState; | |
38 int m_nTrans; | |
39 vector<double> m_init; | |
40 vector<size_t> m_from; | |
41 vector<size_t> m_to; | |
42 vector<double> m_transProb; | |
43 | |
44 // variables for decoding | |
45 deque<double> m_scale; | |
46 deque<vector<int> > m_psi; | |
47 vector<double> m_delta; | |
48 vector<double> m_oldDelta; | |
33 }; | 49 }; |
34 | 50 |
35 #endif | 51 #endif |