📄 hmm.h
字号:
/*
Implements a hidden Markov model and its testing
algorithms including Forward-Backward and Viterbi.
*/
class HMM
{
public:
/* number of states */
int numStates;
/* size of output vocabulary */
int sigmaSize;
/* number of dimensions */
int dimensions;
/* output vocabulary */
double **V;
/* initial state probabilities */
double *pi;
/* transition probabilities */
double **a;
/* emission probabilities */
double **b;
/* constructors */
HMM(int numOfStates, int vocabSize);
HMM(int numOfStates, int vocabSize, int d);
/* destructor */
~HMM();
/* HMM algorithms */
double** forwardProc(int* o, int T);
double** backwardProc(int* o, int T);
double** viterbi(int* o, int T);
/* conversion if real values (not indices) are used */
int* convert(double** sequence, int T);
/* prints HMM parameters on console */
void print();
};
/* loads an HMM from a given file storing an HMM */
HMM* load(char* filename);
/* calculates the Euclidean distance between two symbols */
double euclidDistance(double* O, double** V, int dim, int k);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -