PageRenderTime 31ms CodeModel.GetById 20ms RepoModel.GetById 0ms app.codeStats 0ms

/ghmm/ghmm/ghmm.h

#
C Header | 221 lines | 47 code | 41 blank | 133 comment | 0 complexity | 7bc6bd2391e9e93c541ff8fa856eaddb MD5 | raw file
Possible License(s): GPL-2.0, LGPL-2.0
  1. /*******************************************************************************
  2. *
  3. * This file is part of the General Hidden Markov Model Library,
  4. * GHMM version __VERSION__, see http://ghmm.org
  5. *
  6. * Filename: ghmm/ghmm/ghmm.h
  7. * Authors: Alexander Schliep, Janne Grunau
  8. *
  9. * Copyright (C) 1998-2004 Alexander Schliep
  10. * Copyright (C) 1998-2001 ZAIK/ZPR, Universitaet zu Koeln
  11. * Copyright (C) 2002-2004 Max-Planck-Institut fuer Molekulare Genetik,
  12. * Berlin
  13. *
  14. * Contact: schliep@ghmm.org
  15. *
  16. * This library is free software; you can redistribute it and/or
  17. * modify it under the terms of the GNU Library General Public
  18. * License as published by the Free Software Foundation; either
  19. * version 2 of the License, or (at your option) any later version.
  20. *
  21. * This library is distributed in the hope that it will be useful,
  22. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  23. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  24. * Library General Public License for more details.
  25. *
  26. * You should have received a copy of the GNU Library General Public
  27. * License along with this library; if not, write to the Free
  28. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  29. *
  30. *
  31. * This file is version $Revision: 2277 $
  32. * from $Date: 2009-04-28 12:44:31 +0000 (Tue, 28 Apr 2009) $
  33. * last change by $Author: grunau $.
  34. *
  35. *******************************************************************************/
  36. #ifndef GHMM_H
  37. #define GHMM_H
  38. #ifdef __cplusplus
  39. extern "C" {
  40. #endif
  41. #include "ghmmconfig.h"
  42. /*! \mainpage GHMM library
  43. *
  44. * The General Hidden Markov Model library (GHMM) is a freely available
  45. * LGPL-ed C library implementing efficient data structures and algorithms
  46. * for basic and extended HMMs. The development is hosted at
  47. * <A HREF="http://sourceforge.net/projects/ghmm/">Sourceforge</A>,
  48. * where you have access to the Subversion repository, mailing lists and forums.
  49. *
  50. * The GHMM is developed by the <A HREF="http://algorithmics.molgen.mpg.de/">
  51. * Algorithmics group</A> at the <A HREF="http://www.molgen.mpg.de/">
  52. * Max Planck Institute for Molecular Genetics</A>.
  53. *
  54. * \par Features:
  55. * - Discrete and continous emissions
  56. * - Mixtures of PDFs for continous emissions
  57. * - Non-homogenous Markov chains
  58. * - Pair HMMs (contributed by Genoscope)
  59. * - Clustering and mixture modelling for HMMs
  60. * - Graphical Editor HMMEd
  61. * - Python bindings
  62. * - XML-based file format
  63. *
  64. * \author Achim Gaedke
  65. * \author Alexander Riemer
  66. * \author Alexander Schliep
  67. * \author Andrea Weisse
  68. * \author Barthel Steckemetz
  69. * \author Benjamin Georgi
  70. * \author Berhard Knab
  71. * \author Bernd Wichern
  72. * \author Christoph Hafemeister
  73. * \author Ivan Costa Filho
  74. * \author Janne Grunau
  75. * \author Mathias Heinig
  76. * \author Peter Pipenbacher
  77. * \author Sebastian Meller
  78. * \author Thordis Linda Thorarinsdottir
  79. * \author Utz Pape
  80. * \author Wasinee Rungsarityotin
  81. *
  82. */
  83. /**@name GHMM-Globals */
  84. /*@{ (Doc++-Group: globals) */
  85. /** @name type_constants
  86. Constants giving model variations */
  87. #define GHMM_kNotSpecified (0)
  88. /** Model is a left-right */
  89. #define GHMM_kLeftRight (1)
  90. /** Model contains silent states (i.e., states without emissions) */
  91. #define GHMM_kSilentStates (1 << 2)
  92. /** Model has states with tied emission probabilities */
  93. #define GHMM_kTiedEmissions (1 << 3)
  94. #define GHMM_kUntied (-1)
  95. /** Model has states emission probabilities conditioned on previous orders */
  96. #define GHMM_kHigherOrderEmissions (1 << 4)
  97. /** Model has background distributions */
  98. #define GHMM_kBackgroundDistributions (1 << 5)
  99. #define GHMM_kNoBackgroundDistribution (-1)
  100. /** Model is a class HMM with labeled states */
  101. #define GHMM_kLabeledStates (1 << 6)
  102. #define GHMM_kTransitionClasses (1 << 7)
  103. #define GHMM_kDiscreteHMM (1 << 8)
  104. #define GHMM_kContinuousHMM (1 << 9)
  105. #define GHMM_kPairHMM (1 << 10)
  106. #define GHMM_kMultivariate (1 << 11)
  107. /*@} (Doc++-Group: GHMM-Globals) */
  108. /*@{ (Doc++-Group: Konstanten) */
  109. /**
  110. Convergence: Halt criterium for Baum-Welch reestimation if the difference
  111. of log(P) in two consecutive iterations is smaller than
  112. (GHMM_EPS_ITER_BW * log(P))
  113. */
  114. #define GHMM_EPS_ITER_BW 0.0001
  115. /**
  116. If the absolute difference of two numbers is smaller the GHMM_EPS_PREC,
  117. then the numbers are equal. (Instead of using zero )
  118. */
  119. #define GHMM_EPS_PREC 1E-8
  120. /**
  121. Minimum value for U
  122. */
  123. #define GHMM_EPS_U 1E-4
  124. /**
  125. Maximum number of iterations in reestimate
  126. */
  127. #define GHMM_MAX_ITER_BW 500
  128. /**
  129. Maximum length of a sequence
  130. */
  131. #define GHMM_MAX_SEQ_LEN 1000000
  132. /**
  133. Maximum number of sequences
  134. */
  135. #define GHMM_MAX_SEQ_NUMBER 1500000
  136. /**
  137. A value that is put in for log_p in the calculation of
  138. the objective function if ghmm_cmodel_logp returns -1 (error).
  139. */
  140. #define GHMM_PENALTY_LOGP -500.0
  141. /**
  142. The left limit for the normal density
  143. */
  144. #define GHMM_EPS_NDT 0.1
  145. /*@} (Doc++-Group: Constants) */
  146. /*@{ (Doc++-Group: Logging) */
  147. void ghmm_set_logfunc(void (* fptr)(int, const char *, void *), void * clientdata);
  148. void ghmm_set_loglevel(int level);
  149. /*@} (Doc++-Group: Logging) */
  150. /*@{ (Doc++-Group: Common data structures) */
  151. /** Mapping between symbols of the distribution and integers [0,M)
  152. */
  153. typedef struct {
  154. int id;
  155. char* description;
  156. unsigned int size;
  157. char** symbols;
  158. } ghmm_alphabet;
  159. /** A container for background distributions to be used in the reestimation.
  160. *
  161. * Model has an ID (== index) to be used for the arrays
  162. * background_distributions.order and background_distributions.b
  163. */
  164. typedef struct {
  165. /** Number of distributions */
  166. int n;
  167. /** Number of symbols in alphabet */
  168. int m;
  169. /** Order of the respective distribution */
  170. int *order;
  171. /** The probabilities */
  172. double **b;
  173. /** string ids of the background distributions */
  174. char **name;
  175. } ghmm_dbackground;
  176. /*@} (Doc++-Group: Common data structures) */
  177. #ifdef __cplusplus
  178. }
  179. #endif
  180. #endif /* GHMM_H */