?? myhmm.h
字號:
#ifndef DEMO
#define DEMO
#endif
#define HMM_FILE "-hmm"
#define TRAINING_FILE "-train"
#define TESTING_FILE "-test"
#define TRAINED_HMM_FILE "-trainedHmm"
#define TESTED_FILE "-tested"
#define MODE "-mode"
#define TRAINING 1
#define TESTING 2
#define TRAINING_TESTING 3
#define threshold 1e-100
#define threshold2 1e-10
#define threshold3 1e-10
#define noDefObservations -1
/* because two more states are included, two more observations are added */
#define extraObservations 2
/* N - number of possible states */
/* M - number of possible observation */
/* T - the length of the longest input sequence in the training file */
int N, M, T;
/* transition matrix - N x N */
double** transitions;
/* emission matrix - N x M */
double** emissions;
/* initial distribution - 1 x N*/
double* pi;
int iTrain; // the number of the training examples
int iTest; // the number of the testing examples
char* observations; // char observations[ M ]; the array to store all the observations
int observationsDefined = FALSE;
char* defTrainedHmmFile = "default.trainedHmm";
char* defTestedFile = "default.testedFile";
double** alpha;//double alpha[ T ][ N ];
double** beta;//double beta[ T ][ N ];
char **trainData;
char **testData;
int body(int argc, char** argv);
void init();
void saveHmm(char *out);
void calTransitions();
void test(char* testedFile);
/* probability of the sequence given the HMM model */
double forward(char *line);
double backward(char *line);
void viterbi(char *line, char *buffer);
void baumWelch();
char getSymbol(int k);
int getObservation(char ch);
void readObservations(char** trainData);
void initTransitions();
void initEmissions();
void initPi();
void loadHMM(char* hmmFile);
void loadSeq(char***pSeq, char* seqFile);
int AllocateDataSpaceChar(char ***pData, int row, int col);
void post_processing();
void check_mode(int mode, char* trainFile, char* testFile);
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -