hmm.h

来自「about hidden Markov model every algorith」· C头文件 代码 · 共 53 行

H
53
字号
/* 
   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 + =
减小字号Ctrl + -
显示快捷键?