📄 smodel.h
字号:
inside the function, when a final state in the model is reach (a state with no output). If the model has no final state, the sequences will have length MAX_SEQ_LEN. @return pointer to an array of sequences @param smo: model @param seed: initial parameter for the random value generator (an integer). If seed == 0, then the random value generator is not initialized. @param global_len: length of sequences (=0: automatically via final states) @param seq_number: number of sequences @param label: label tag @param Tmax: maximal sequence length, set to MAX_SEQ_LEN if -1 */ ghmm_cseq *ghmm_cmodel_generate_sequences (ghmm_cmodel * smo, int seed, int global_len, long seq_number, long label, int Tmax);/** Computes sum over all sequence of seq_w * log( P ( O|lambda ) ). If a sequence can't be generated by smo error cost of seq_w * PRENALTY_LOGP are imposed. @return n: number of evaluated sequences, -1: error @param smo ghmm_cmodel @param sqd sequence struct @param log\_p evaluated log likelihood*/ int ghmm_cmodel_likelihood (ghmm_cmodel * smo, ghmm_cseq * sqd, double *log_p);/** Computes log likelihood for all sequence of seq_w * log( P ( O|lambda ) ). If a sequence can't be generated by smo error cost of seq_w * PRENALTY_LOGP are imposed. @return n: number of evaluated sequences, -1: error @param smo ghmm_cmodel @param sqd sequence struct @param log\_p array of evaluated likelihoods*/ int ghmm_cmodel_individual_likelihoods (ghmm_cmodel * smo, ghmm_cseq * sqd, double *log_ps);/** Reads an XML file with specifications for one or more smodels. All parameters in matrix or vector form. @return vector of read smodels @param filename input xml file @param smo_number number of smodels to read*/ ghmm_cmodel **ghmm_cmodel_xml_read (const char *filename, int *smo_number);/** Writes an XML file with specifications for one or more smodels. @return 0:sucess, -1:error @param filename output xml file @param smo ghmm_cmodel(s) @param smo_number number of smodels to write*/ int ghmm_cmodel_xml_write(ghmm_cmodel** smo, const char *file, int smo_number);/** Prints one ghmm_cmodel in matrix form. @param file output file @param smo ghmm_cmodel*/ void ghmm_cmodel_print (FILE * file, ghmm_cmodel * smo);/** Prints one ghmm_cmodel with only one transition Matrix A (=Ak\_0). @param file output file @param smo ghmm_cmodel*/ void ghmm_cmodel_print_oneA (FILE * file, ghmm_cmodel * smo);/** Prints transition matrix of specified class. @param file output file @param smo ghmm_cmodel @param k transition class @param tab format: leading tab @param separator format: seperator @param ending format: end of data in line*/ void ghmm_cmodel_Ak_print (FILE * file, ghmm_cmodel * smo, int k, char *tab, char *separator, char *ending);/** Prints weight matrix of output functions of an smodel. @param file output file @param smo ghmm_cmodel @param tab format: leading tab @param separator format: seperator @param ending format: end of data in line*/ void ghmm_cmodel_C_print (FILE * file, ghmm_cmodel * smo, char *tab, char *separator, char *ending);/** Prints mean matrix of output functions of an smodel. @param file output file @param smo ghmm_cmodel @param tab format: leading tab @param separator format: seperator @param ending format: end of data in line*/ void ghmm_cmodel_Mue_print (FILE * file, ghmm_cmodel * smo, char *tab, char *separator, char *ending);/** Prints variance matrix of output functions of an smodel. @param file output file @param smo ghmm_cmodel @param tab format: leading tab @param separator format: seperator @param ending format: end of data in line*/ void ghmm_cmodel_U_print (FILE * file, ghmm_cmodel * smo, char *tab, char *separator, char *ending);/** Prints initial prob vector of an smodel. @param file output file @param smo ghmm_cmodel @param tab format: leading tab @param separator format: seperator @param ending format: end of data in line*/ void ghmm_cmodel_Pi_print (FILE * file, ghmm_cmodel * smo, char *tab, char *separator, char *ending);/** Prints vector of fix\_states. @param file output file @param smo ghmm_cmodel @param tab format: leading tab @param separator format: seperator @param ending format: end of data in line*/ void ghmm_cmodel_fix_print (FILE * file, ghmm_cmodel * smo, char *tab, char *separator, char *ending);/** Computes the density of one symbol (omega) in a given state and a given output component @return calculated density @param smo ghmm_cmodel @param state state @param m output component @param omega given symbol*/ double ghmm_cmodel_calc_cmbm (ghmm_cmodel * smo, int state, int m, double omega);/** Computes the density of one symbol (omega) in a given state (sums over all output components @return calculated density @param smo ghmm_cmodel @param state state @param omega given symbol*/ double ghmm_cmodel_calc_b (ghmm_cmodel * smo, int state, double omega);/** Computes probabilistic distance of two models @return the distance @param cm0 ghmm_cmodel used for generating random output @param cm ghmm_cmodel to compare with @param maxT maximum output length (for HMMs with absorbing states multiple sequences with a toal length of at least maxT will be generated) @param symmetric flag, whether to symmetrize distance (not implemented yet) @param verbose flag, whether to monitor distance in 40 steps. Prints to stdout (yuk!)*/ double ghmm_cmodel_prob_distance (ghmm_cmodel * cm0, ghmm_cmodel * cm, int maxT, int symmetric, int verbose);/** Computes value of distribution function for a given symbol omega, a given ghmm_dstate and a given output component. @return value of distribution function @param smo ghmm_cmodel @param state state @param m component @param omega symbol*/ double ghmm_cmodel_calc_cmBm (ghmm_cmodel * smo, int state, int m, double omega);/** Computes value of distribution function for a given symbol omega and a given state. Sums over all components. @return value of distribution function @param smo ghmm_cmodel @param state state @param omega symbol*/ double ghmm_cmodel_calc_B (ghmm_cmodel * smo, int state, double omega);/** Computes the number of free parameters in an array of smodels. E.g. if the number of parameter from pi is N - 1. Counts only those parameters, that can be changed during training. If pi[i] = 0 it is not counted, since it can't be changed. @return number of free parameters @param smo ghmm_cmodel @param smo\_number number of smodels*/ int ghmm_cmodel_count_free_parameter (ghmm_cmodel ** smo, int smo_number);/*============================================================================*//* keep the following functions for first distribution??? --> BK ? *//** Generates interval(a,b) with B(a) < 0.01, B(b) > 0.99 @param smo continous HMM @param state given state @param a return-value: left side @param b return-value: right side*/ void ghmm_cmodel_get_interval_B (ghmm_cmodel * smo, int state, double *a, double *b);/** Get transition probabality from state 'i' to state 'j' to value 'prob'. NOTE: No internal checks @return transition probability from state i to state j @param mo model @param i state index (source) @param j state index (target) @param c transition class*/ double ghmm_cmodel_get_transition(ghmm_cmodel* mo, int i, int j, int c);/** Set transition from state 'i' to state 'j' to value 'prob'. NOTE: No internal checks - model might get broken if used without care. @param mo model @param i state index (source) @param j state index (target) @param prob probabilitys @param c transition class*/ void ghmm_cmodel_set_transition (ghmm_cmodel* mo, int i, int j, int c, double prob);#ifdef __cplusplus}#endif#endif/*@} (Doc++-Group: smodel) */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -