manual_HMM.cpp 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451
  1. /* manual_HMM.cpp
  2. *
  3. * Copyright (C) 2011-2014, 2015 David Weenink
  4. *
  5. * This code is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 2 of the License, or (at
  8. * your option) any later version.
  9. *
  10. * This code is distributed in the hope that it will be useful, but
  11. * WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  13. * General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this work. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. /*
  19. djmw 20101009 Initial version
  20. */
  21. #include "ManPagesM.h"
  22. void manual_HMM (ManPages me);
  23. void manual_HMM (ManPages me)
  24. {
  25. MAN_BEGIN (U"expectation-maximization", U"djmw", 20111130)
  26. NORMAL (U"Expectation-maximization (EM) is an iterative method used to find maximum "
  27. "likelihood estimates of parameters in probabilistic models, where the model depends on "
  28. "unobserved, also called %%latent%, variables. EM alternates between performing an expectation (E) step, "
  29. "which computes an expectation of the likelihood by including the latent variables as if they "
  30. "were observed, and a maximization (M) step, which computes the maximum likelihood "
  31. "estimates of the parameters by maximizing the expected likelihood found in the E step. The "
  32. "parameters found on the M step are then used to start another E step, and the process is "
  33. "repeated until some criterion is satisfied. EM is frequently used for data clustering like for example in "
  34. "@@TableOfReal: To GaussianMixture...|Gaussian mixtures@ or in the @@HMM & HMMObservationSequences: Learn...|Baum-Welch training@ of a Hidden Markov Model.")
  35. MAN_END
  36. MAN_BEGIN (U"GaussianMixture", U"djmw", 20101026)
  37. INTRO (U"A Gaussian mixture is a probability density function (p.d.f.). It is a combination of several Gaussian densities.")
  38. NORMAL (U"The GaussianMixture's p.d.f. is defined as the weighted sum of %K multivariate Gaussian p.d.f's:")
  39. FORMULA (U"pdf(x) = \\Si__%%i%=1_^^%K^ p__%i_ %N(%x;\\mu__%i_,\\Si__%i_),")
  40. NORMAL (U"where each %N(%x;\\mu__%i_,\\Si__%i_) is a multivariate p.d.f. with mean \\mu__%i_ and covariance matrix \\Si__%i_. The coefficients %p__%i_ sum to 1. ")
  41. NORMAL (U"For an introduction to Gaussian mixtures see for example @@Bishop (2006)@.")
  42. MAN_END
  43. MAN_BEGIN (U"GaussianMixture: Draw concentration ellipses...", U"djmw", 20101101)
  44. INTRO (U"Draws the concentration ellipse for each component in the @@GaussianMixture@. ")
  45. NORMAL (U"The principal component plane will be determined from @@GaussianMixture: To PCA@.")
  46. NORMAL (U"You might also use another @PCA and to combine it with a GaussianMixture for drawing (@@GaussianMixture & PCA: Draw concentration ellipses...@).")
  47. ENTRY (U"Settings")
  48. TAG (U"##Number of sigmas")
  49. DEFINITION (U"determines the @@concentration ellipse|data coverage@.")
  50. TAG (U"##Principal component plane")
  51. DEFINITION (U"determines whether the principal component plane is used or not for drawing.")
  52. MAN_END
  53. MAN_BEGIN (U"GaussianMixture: Get probability at position", U"djmw",20101103)
  54. INTRO (U"Evaluate the pdf of the @@GaussianMixture@ at the given position.")
  55. MAN_END
  56. MAN_BEGIN (U"GaussianMixture & PCA: Draw concentration ellipses...", U"djmw", 20101101)
  57. INTRO (U"Draws the concentration ellipse for each component in the @@GaussianMixture@ in the plane spanned by the selected @PCA.")
  58. ENTRY (U"Settings")
  59. TAG (U"##Number of sigmas")
  60. DEFINITION (U"determines the @@concentration ellipse|data coverage@.")
  61. MAN_END
  62. MAN_BEGIN (U"GaussianMixture: Draw marginal pdf...", U"djmw", 20101122)
  63. INTRO (U"A command to draw the marginal p.d.f. (probability density function) of the selected @GaussianMixture.")
  64. NORMAL (U"A marginal distribution is the projection of the (multivariate) p.d.f. on one dimension or direction. "
  65. "This direction may also be externally defined by selecting a @PCA and a GaussianMixture together.")
  66. MAN_END
  67. MAN_BEGIN (U"GaussianMixture: Split component...", U"djmw", 20101122)
  68. INTRO (U"Splits one component of the selected @GaussianMixture into two components.")
  69. NORMAL (U"The selected component is split based on a @PCA analysis of its covariance matrix. The new means are situated "
  70. "around the old components mean, 1\\si apart in the first principal components direction, and the new covariances are "
  71. "constructed with information from the old covariance matrix. ")
  72. NORMAL (U"The details of the algorith are described in @@Zhang et al. (2003)@.")
  73. MAN_END
  74. MAN_BEGIN (U"GaussianMixture: To PCA", U"djmw", 20101030)
  75. INTRO (U"Creates a @PCA from the selected @GaussianMixture.")
  76. NORMAL (U"The PCA is calculated from the @@GaussianMixture: To Covariance (total)|total covariance matrix@ of the GaussianMixture.")
  77. MAN_END
  78. MAN_BEGIN (U"GaussianMixture & PCA: To Matrix (density)...", U"djmw", 20101101)
  79. INTRO (U"Represent the @@GaussianMixture@ p.d.f. on the plane spanned by @@PCA@. This makes it possible to draw "
  80. "the p.d.f. as grey values with one of the special @@Matrix@ image drawing methods.")
  81. NORMAL (U"For each cell in the matrix of dimension %%numberOfRows% \\xx %%numberOfColumns%, the p.d.f. will be evaluated.")
  82. MAN_END
  83. MAN_BEGIN (U"GaussianMixture: To Covariance (between)", U"djmw", 20101030)
  84. INTRO (U"The covariance between the centers of the components of the @@GaussianMixture@ is calculated; "
  85. "each center is weighted according to its mixing probability.")
  86. MAN_END
  87. MAN_BEGIN (U"GaussianMixture: To Covariance (within)", U"djmw", 20101120)
  88. INTRO (U"The covariances of the components of the @@GaussianMixture@ are pooled.")
  89. MAN_END
  90. MAN_BEGIN (U"GaussianMixture: To Covariance (total)", U"djmw", 20101030)
  91. INTRO (U"The sum of the @@GaussianMixture: To Covariance (within)|within@ and @@GaussianMixture: To Covariance (between)|between@ covariances of the @@GaussianMixture@ is calculated.")
  92. MAN_END
  93. MAN_BEGIN (U"GaussianMixture: To TableOfReal (random sampling)...", U"djmw", 20101030)
  94. INTRO (U"The selected @@GaussianMixture@ is used as a generator of data.")
  95. ENTRY (U"Setting")
  96. TAG (U"##Number of data points")
  97. DEFINITION (U"determines how many random data point have to be generated.")
  98. ENTRY (U"Algorithm")
  99. NORMAL (U"For each data point to be generated:")
  100. NORMAL (U"1. A random number decides to which component in the mixture the data point will belong.")
  101. NORMAL (U"2. According to the procedure described in @@Covariance: To TableOfReal (random sampling)...@, one "
  102. "data point will be generated.")
  103. MAN_END
  104. MAN_BEGIN (U"TableOfReal: To GaussianMixture...", U"djmw", 20150930)
  105. INTRO (U"Creates a @@GaussianMixture@ from the selected @@TableOfReal@ by an @@expectation-maximization|"
  106. "expectation-maximization@ procedure.")
  107. ENTRY (U"Settings")
  108. TAG (U"##Number of components")
  109. DEFINITION (U"defines the number of Gaussians in the mixture.")
  110. TAG (U"##Tolerance of minimizer")
  111. DEFINITION (U"defines when to stop optimizing. If the relative difference between the likelihoods at two successive "
  112. "iteration steps differs by less then the tolerance we stop, i.e. when |(%L(%i-1)-%L(%i))/%L(%i)| < %%tolerance%. ")
  113. TAG (U"##Maximum number of iterations")
  114. DEFINITION (U"defines another stopping criterion. The EM iteration will stop when either the tolerance "
  115. "is reached or the maximum number of iterations. If zero is chosen, no iteration will be performed and the "
  116. "GaussianMixture will be initialized with the initial guess.")
  117. TAG (U"##Stability coefficient lambda")
  118. DEFINITION (U"defines the fraction of the total covariance that will be added to the each of the mixture "
  119. "covariance matrices during the EM iteration. This may prevent one or more of these matrices to become singular.")
  120. TAG (U"##Covariance matrices are")
  121. DEFINITION (U"defines whether the complete covariance matrices in the mixture have to be calculated or only the diagonal.")
  122. TAG (U"##Criterion based on")
  123. DEFINITION (U"defines how the @@GaussianMixture & TableOfReal: Get likelihood value...|likelihood of the data given the model is calculated@.")
  124. ENTRY (U"Expectation\\--Maximization Algorithm")
  125. NORMAL (U"The Expectation\\--Maximization (EM) algorithm is an iterative procedure to maximize the likelihood of the data given a model. For a "
  126. "GaussianMixture, the parameters in the model are the centers and the covariances of all components in the mixture "
  127. "and their mixing probabilities.")
  128. NORMAL (U"The number of parameters depends on the number of components in the mixture and the dimension of the data. "
  129. "For a full covariance matrix we have to find %dimension%(%dimension%+1)/2 matrix elements and another "
  130. " %dimension vector elements for its center. This makes the total number of parameters that have to be estimated "
  131. "for a mixture with ##Number of components# components equal to "
  132. "%numberOfComponents \\.c %dimension%(%dimension%+3)/2 + %numberOfComponents.")
  133. NORMAL (U"For diagonal covariance matrices the number of parameters reduces considerably.")
  134. NORMAL (U"The EM iteration has to start with a sensible initial guess for all the parameters. For the initial guess, "
  135. "we derive our centers from positions on the 1-\\si ellipse in the plane spanned by the first two principal "
  136. "components. We then make all covariance matrices equal to a scaled down version of the total covariance matrix "
  137. "where the scaling factor depends on the number of components and the quotient of the between and within variance. "
  138. "Initialy all mixing probabilities will be chosen equal.")
  139. NORMAL (U"How to proceed from the initial guess with the EM to find the optimal values for all the parameters "
  140. "in the Gaussian mixture is explained in great detail by @@Bishop (2006)@.")
  141. MAN_END
  142. #define GaussianMixture_OPTION_MENU_CRITERIA \
  143. OPTIONMENU (U"Criterion based on", 1) \
  144. OPTION (U"Maximum likelihood") \
  145. OPTION (U"Minimum message length") \
  146. OPTION (U"Bayes information") \
  147. OPTION (U"Akaike information") \
  148. OPTION (U"Akaike corrected") \
  149. OPTION (U"Complete-data ML")
  150. MAN_BEGIN (U"GaussianMixture & TableOfReal: Get likelihood value...", U"djmw", 20101125)
  151. INTRO (U"Calculates how well the @GaussianMixture model fits the data according to a criterion.")
  152. ENTRY (U"Settings")
  153. TAG (U"##Maximum likelihood")
  154. FORMULA (U"ML = \\Si__%i=1..%n_ log (\\Si__%m=1..%k_ \\al__%k_ %p__%%ik%_)")
  155. TAG (U"##Minimum message length")
  156. FORMULA (U"DL = ML - 0.5(N\\.c\\Si__%m=1..%k_ log(%n\\al__%m_/12) -%k\\.clog(%n/12) -%k(%N+1))")
  157. TAG (U"##Bayes information")
  158. FORMULA (U"BIC = 2\\.cML - k\\.cN\\.clog(n)")
  159. TAG (U"##Akaike information")
  160. FORMULA (U"AIC = 2(ML - k\\.cN) ")
  161. TAG (U"##Akaike corrected")
  162. FORMULA (U"AICc = 2(ML - k\\.cN\\.cn/(n-k\\.cN-1))")
  163. TAG (U"##Complete-data ML")
  164. FORMULA (U"\\Si__%i=1..%n_\\Si__%m=1..%k_ \\ga__%%im%_ log (\\ga__%%im%_)")
  165. NORMAL (U"In the formulas above %n is the number of data points, %k is the number of mixture components, %N is the "
  166. "number of parameters in one component, i.e. %d + %d(%d+1)/2 for a full covariance matrix of "
  167. "dimension %d with means. The \\al__%k_ are the mixing probabilities, the %p__%%ik%_ are the probabilities for the %i-th data vector in the %k-th component. The \\ga__%%ik%_ are defined as ")
  168. FORMULA (U"\\ga__%%im%_= \\al__%m_\\.c%p__%%im%_ /(\\Si__%j=1..%k_ \\al__%j_\\.c%p__%%ij%_).")
  169. MAN_END
  170. MAN_BEGIN (U"GaussianMixture & TableOfReal: Improve likelihood...", U"djmw", 20111130)
  171. INTRO (U"Try to improve the likelihood of the parameters in the @@GaussianMixture@ by an @@expectation-maximization@ algorithm.")
  172. ENTRY (U"Settings & EM Algorithm")
  173. NORMAL (U"As decribed in @@TableOfReal: To GaussianMixture...@.")
  174. MAN_END
  175. MAN_BEGIN (U"GaussianMixture & TableOfReal: To Correlation (columns)", U"djmw", 20101111)
  176. INTRO (U"Create a @Correlation matrix from the selected @TableOfReal and the @GaussianMixture.")
  177. NORMAL (U"We start by calculating the ClassificationTable @@GaussianMixture & TableOfReal: To ClassificationTable|from "
  178. "the data and the GaussianMixture@.")
  179. NORMAL (U"Nex we calculate correlations between the %%columns% of the ClassificationTable: cell [%i,%j] of the "
  180. "correlation matrix will then contain the value:")
  181. FORMULA (U"%p[%i] \\.c %p[%j] / (||%p[%i]||\\.c ||%p[%j]||), ")
  182. NORMAL (U"where %p[%i] is the data in the %i-th column of the classification table and ||%p[%i]|| is its Euclidean norm. "
  183. "The index %i runs from 1 to the number of components in the mixture.")
  184. NORMAL (U"Because all the elements in a column are positive numbers, i.e. probabilities, all correlations will be positive numbers too.")
  185. MAN_END
  186. MAN_BEGIN (U"GaussianMixture & TableOfReal: To ClassificationTable", U"djmw", 20101122)
  187. INTRO (U"Create a @ClassificationTable from the selected @TableOfReal and the @GaussianMixture.")
  188. NORMAL (U"The classification table is a matrix with the same number of rows as the selected #TableOfReal "
  189. "object. The number of columns equals the number of components in the mixture. "
  190. "Cell [%i,%j] of the classification table contains the probability "
  191. "that the data in row %i of the TableOfReal belongs to component %j of the mixture.")
  192. MAN_END
  193. MAN_BEGIN (U"GaussianMixture & TableOfReal: To GaussianMixture (CEMM)...", U"djmw", 20101120)
  194. INTRO (U"Find the best @@GaussianMixture@ from the data according to a iterative component-wise optimization algorithm by which components may be deleted.")
  195. ENTRY (U"Settings")
  196. TAG (U"##Minimum number of components")
  197. DEFINITION (U"defines the minimum number of components that have to survive the minimization process. If a value of zero is chosen all components will survive and no deletions will take place.")
  198. TAG (U"##Tolerance of minimizer")
  199. DEFINITION (U"defines when to stop optimizing. If the relative difference between the likelihoods at two successive "
  200. "iteration steps differs by less then the tolerance we stop, i.e. when |(%L(%i-1)-%L(%i))/%L(%i)| < %%tolerance%. ")
  201. TAG (U"##Maximum number of iterations")
  202. DEFINITION (U"defines another stop criterion. Iteration stops whenever the number of iterations reaches this value.")
  203. TAG (U"##Stability coefficient lambda")
  204. DEFINITION (U"defines the fraction of the totat covariance that is added to the covariance of each component to "
  205. "prevent these matrices from becoming singular.")
  206. TAG (U"##Criterion based on")
  207. DEFINITION (U"defines whether the function to be optimized is the log likelihood or the related miminum description length.")
  208. ENTRY (U"Algorithm")
  209. NORMAL (U"The component-wise optimization algorithm is described in @@Figueiredo & Jain (2002)@ where the function to be optimized "
  210. "is the minimum description length defined as:")
  211. FORMULA (U"%L(\\te,%Y) = %N/2 \\Si__%m=1_^^%k^ ln(%n\\al__%k_/12) + %k/2 ln(%n/12) + %k(%N+1)/2 - ln %p(%Y|\\te),")
  212. NORMAL (U"where %k is the number of components, %N is the number of parameters of one component, "
  213. "i.e. %d+%d(%d+1)/2 for a full covariance matrix of dimension %d with means and %d+%d for a diagonal "
  214. "matrix with means; %n is the number of data vectors. The term ln %p(%Y|\\te) is the log likelihood of the data "
  215. "given the model.")
  216. NORMAL (U"For the optimization we either optimize the complete function %L(\\te,%Y) or only the likelihood ln %p(%Y|\\te) term.")
  217. MAN_END
  218. MAN_BEGIN (U"GaussianMixture & TableOfReal: To TableOfReal (BHEP normality tests)...", U"djmw", 20101113)
  219. INTRO (U"Tests the data in the @TableOfReal that belong to the components of the @GaussianMixture for normality "
  220. "according to an adapted version of the @@BHEP multivariate normality test@.")
  221. ENTRY (U"Setting")
  222. TAG (U"##Beta")
  223. DEFINITION (U"determines the smoothing parameter of the data. If %beta equals zero the smoothing is determined "
  224. "automatically for each component of the mixture separately as: ")
  225. FORMULA (U"%beta = 1/(\\Vr2) (2%p+1)^^1/(%p+4)^ n^^1/(%p+4)^,")
  226. NORMAL (U"where %n is the effective number of elements in the component and %p the dimension of the data.")
  227. MAN_END
  228. MAN_BEGIN (U"TableOfReal: To GaussianMixture (row labels)...", U"djmw", 20101101)
  229. INTRO (U"Creates a @@GaussianMixture@ from the selected @TableOfReal. The number of mixture components is determined by the number of different row labels.")
  230. ENTRY (U"Setting")
  231. TAG (U"##Covariance matrices are")
  232. DEFINITION (U"defines whether the complete covariance matrices in the mixture have to be calculated or only the diagonal.")
  233. MAN_END
  234. MAN_BEGIN (U"HMMObservationSequence", U"djmw", 20140117)
  235. INTRO (U"An HMMObservationSequence models a sequence of observations. The observation sequence can be generated "
  236. "by the @HMM or it can be used to train a model.")
  237. MAN_END
  238. MAN_BEGIN (U"HMMStateSequence", U"djmw", 20101010)
  239. INTRO (U"An HMMStateSequence models the sequence of states that an @HMM has traversed.")
  240. MAN_END
  241. MAN_BEGIN (U"HMM", U"djmw", 20130410)
  242. INTRO (U"A HMM is a Hidden Markov Model. Markov models are often used to model observation sequences. "
  243. "The fundamental assumption in a markov model is that the probability of an observation (event) can only "
  244. "depend on the previous observation. "
  245. "A HMM can be visualised as a graph with a number of %%states%. If states are connected they have line connecting them. The following picture shows a HMM with two states, labeled \"Rainy\" and \"Sunny\". Each state can emit three symbols (these are not visible in the graph). ")
  246. SCRIPT (5, 5,
  247. U"Create simple HMM: \"wheather\", \"no\", \"Rainy Sunny\", \"Walk Shop Clean\"\n"
  248. "Draw: \"no\"\n"
  249. "Remove\n")
  250. INTRO (U"For an introduction into HMM's see @@Rabiner (1989)@.")
  251. MAN_END
  252. MAN_BEGIN (U"HMM: Create simple HMM...", U"djmw", 20101009)
  253. INTRO (U"Creates a @@HMM|Hidden Markov Model@ from given states and observation symbols.")
  254. ENTRY (U"Settings")
  255. TAG (U"##Name")
  256. DEFINITION (U"determines the name (for the list of objects).")
  257. TAG (U"##States")
  258. DEFINITION (U"determines the number of and the names of the states.")
  259. TAG (U"##Symbols")
  260. DEFINITION (U"determines the number and the names of the observation symbols.")
  261. NORMAL (U"You can define a (not hidden) Markov model by leaving either the States or the Symbols field empty.")
  262. NORMAL (U"The model is initialised with equal probabilities for all the transitions and emissions.")
  263. MAN_END
  264. MAN_BEGIN (U"HMM: Extract transition probabilities", U"djmw", 20101020)
  265. INTRO (U"Extract the transition probabilities of the selected @@HMM@ as a @@TableOfReal@.")
  266. NORMAL (U"The row label shows the %%from% state and the column label the %%to% state, therefore the cell element "
  267. "in row %i and column %j shows the probability of making a transition from state %i to state %j.")
  268. MAN_END
  269. MAN_BEGIN (U"HMM: Extract emission probabilities", U"djmw", 20101020)
  270. INTRO (U"Extract the emission probabilities of the selected @@HMM@ as a @@TableOfReal@.")
  271. NORMAL (U"The row label shows the %%from% state and the column label the %%to% symbol, therefore the cell element "
  272. "in row %i and column %j shows the probability of emitting symbol %j from state %i.")
  273. MAN_END
  274. MAN_BEGIN (U"HMM & HMM: Get cross-entropy...", U"djmw", 20101017)
  275. INTRO (U"Calculates the cross-entropy between the two selected @@HMM@ models based on observation sequences.")
  276. ENTRY (U"Settings")
  277. TAG (U"##Observation length")
  278. DEFINITION (U"defines the number of observations that have to generated.")
  279. TAG (U"##Symmetric")
  280. DEFINITION (U"defines whether the symmetric formula is used in the calculation.")
  281. ENTRY (U"Algorithm")
  282. NORMAL (U"The cross-entropy is a measure of the distance between two models \\la__1_ and \\la__2_. It is defined as")
  283. FORMULA (U"%D(\\la__1_,\\la__2_) = 1/%N (log %p(%O__2_|\\la__1_) - log %p(%O__2_|\\la__2_)),")
  284. NORMAL (U"where %O__2_ is an observation sequence of length %N generated by model \\la__2_.")
  285. NORMAL (U"The symmetrized version is:")
  286. FORMULA (U"%D__%s_(\\la__1_,\\la__2_) = (%D(\\la__1_,\\la__2_) + %D(\\la__2_,\\la__1_))/2.")
  287. MAN_END
  288. MAN_BEGIN (U"HMM & HMMObservationSequence: Get cross-entropy", U"djmw", 20101017)
  289. INTRO (U"Calculates the cross-entropy between the selected @@HMM@ model and the @@HMMObservationSequence@.")
  290. NORMAL (U"The cross-entropy is a useful upper bound for the entropy of a model. An approximation to the cross-entropy for a model on a observation sequence %O of length %N is: ")
  291. FORMULA (U"%H(%O) = -1/%N log %p(%O),")
  292. NORMAL (U"where %p(%O) is the probability of the observation sequence given the model.")
  293. MAN_END
  294. MAN_BEGIN (U"HMM & HMM & HMMObservationSequence: Get cross-entropy", U"djmw", 20101017)
  295. INTRO (U"Get the (symmetric) cross-entropy for the two selected @HMM models and an observation sequence.")
  296. NORMAL (U"See @@HMM & HMM: Get cross-entropy...@.")
  297. MAN_END
  298. MAN_BEGIN (U"HMM: To HMMObservationSequence...", U"djmw", 20101010)
  299. INTRO (U"Use the selected @HMM as a generator for an observation sequence.")
  300. ENTRY (U"Settings")
  301. TAG (U"##Start state")
  302. DEFINITION (U"defines the state in which the HMM starts. If a zero is given the start state is randomly chosen according to the start probabilities.")
  303. TAG (U"##Number of observations")
  304. DEFINITION (U"defines the number of observations to generate. For models of %%finite% duration such as left-to-right models, the HMM generator may stop before this number is reached.")
  305. MAN_END
  306. MAN_BEGIN (U"HMM: Get transition probability...", U"djmw", 20101010)
  307. INTRO (U"For the selected @HMM get the probability to make a transition from one state to the other.")
  308. MAN_END
  309. MAN_BEGIN (U"HMM: Get emission probability...", U"djmw", 20101010)
  310. INTRO (U"For the selected @HMM get the probability that in a given state a particular symbol will be emitted.")
  311. MAN_END
  312. MAN_BEGIN (U"HMM: Get start probability...", U"djmw", 20101010)
  313. INTRO (U"For the selected @HMM get the probabilities that the model will start in a particular state.")
  314. MAN_END
  315. MAN_BEGIN (U"HMM: Get p (time, state)...", U"djmw", 20101010)
  316. INTRO (U"For the selected @HMM get the probability that after a given number of time steps the HMM will be in "
  317. "a particular state.")
  318. MAN_END
  319. MAN_BEGIN (U"HMM: Get p (time, state, symbol)...", U"djmw", 20101010)
  320. INTRO (U"For the selected @HMM get the probability that after a given number of time steps the HMM will be in "
  321. "a particular state and emits a certain symbol.")
  322. NORMAL (U"This probability is the product of the %%probability being in particular state at that time (index)% and the %%probability of emitting a certain symbol in that state%.")
  323. MAN_END
  324. MAN_BEGIN (U"HMM: Get probability staying in state...", U"djmw", 20101010)
  325. INTRO (U"For the selected @HMM get the probability that it stays exactly the given number of times in that state.")
  326. NORMAL (U"This probability is %\\al__%%ii%_^^numberOfTimes-1^(1 - %\\al__%%ii%_),\n"
  327. "where \\al__%%ii%_ is the probability of staying in state %i.")
  328. MAN_END
  329. MAN_BEGIN (U"HMM: Get expected duration in state...", U"djmw", 20101010)
  330. INTRO (U"For the selected @HMM get the number of time units that the system is expected to stay in that state.")
  331. MAN_END
  332. MAN_BEGIN (U"HMM & HMMStateSequence: Get probability", U"djmw", 20101010)
  333. INTRO (U"Get the natural logarithm of the probability that the selected @@HMMStateSequence|state sequence@ was generated by the selected @HMM.")
  334. MAN_END
  335. MAN_BEGIN (U"HMM & HMMObservationSequence: Get probability", U"djmw", 20101010)
  336. INTRO (U"Get the natural logarithm of the probability that the selected @@HMMObservationSequence|state sequence@ was generated by the selected @HMM.")
  337. ENTRY (U"Algorithm")
  338. NORMAL (U"Viterbi")
  339. MAN_END
  340. MAN_BEGIN (U"HMM: Set transition probabilities...", U"djmw", 20101010)
  341. INTRO (U"Sets the probabilities for making a transition from one state to all other states.")
  342. ENTRY (U"Settings")
  343. TAG (U"##Probabilities")
  344. DEFINITION (U"the list of transition probabilities from the given state. "
  345. "The values given will be scaled as probabilities. A zero is used to mark a transition that will never occur. ")
  346. ENTRY (U"Examples")
  347. NORMAL (U"For a three state model the input \"1 3 7\" will result in the same probabilities as the input \"0.1 0.3 0.7\".")
  348. MAN_END
  349. MAN_BEGIN (U"HMM: Set emission probabilities...", U"djmw", 20101010)
  350. INTRO (U"Sets the probabilities for emitting the symbols from the state.")
  351. NORMAL (U"The values given will be scaled as probabilities. ")
  352. ENTRY (U"Examples")
  353. NORMAL (U"For an HMM with four symbols the input \"1 3 3 3\" will result in the same probabilities as the input \"0.1 0.3 0.3 0.3\".")
  354. MAN_END
  355. MAN_BEGIN (U"HMM: Set start probabilities...", U"djmw", 20101010)
  356. INTRO (U"Sets the probabilities that the model starts in the particular states.")
  357. NORMAL (U"The values given will be scaled as probabilities. ")
  358. MAN_END
  359. MAN_BEGIN (U"HMM & HMMObservationSequence: To TableOfReal (bigrams)...", U"djmw", 20101019)
  360. INTRO (U"Get a table with bigrams and marginals form the selected @HMMObservationSequence and the @HMM.")
  361. NORMAL (U"The entry at row %i and column %j shows how often the %j-th symbol follows the %i-th symbol in the observation sequence.")
  362. ENTRY (U"Remark")
  363. NORMAL (U"The row and colum marginals for the first and the last element in the obsevation sequence will not be equal because there is no transition to the first and no transition from the last one.")
  364. MAN_END
  365. MAN_BEGIN (U"HMMObservationSequence: To TableOfReal (bigrams)...", U"djmw", 20101019)
  366. INTRO (U"Get a table with bigrams form the selected @HMMObservationSequence.")
  367. NORMAL (U"See also @@HMM & HMMObservationSequence: To TableOfReal (bigrams)...@.")
  368. MAN_END
  369. MAN_BEGIN (U"HMM & HMMObservationSequences: Learn...", U"djmw", 20111130)
  370. INTRO (U"Train the transition and emission probabilities of the @HMM from the observations.")
  371. ENTRY (U"Algorithm")
  372. NORMAL (U"The Baum-Welch @@expectation-maximization@ procedure. It uses the forward and backward procedures to (re)estimate the parameters until convergence is reached.")
  373. MAN_END
  374. MAN_BEGIN (U"Bishop (2006)", U"djmw", 20101026)
  375. NORMAL (U"C.M. Bishop (2006): %%Pattern recognition and machine learning%. Springer.")
  376. MAN_END
  377. MAN_BEGIN (U"Figueiredo & Jain (2002)", U"djmw", 20101229)
  378. NORMAL (U"Mario A.T. Figueiredo & Anil K. Jain (2002): \"Unsupervised learning of finite mixture models.\" "
  379. "%%IEEE Transactions on Pattern Analysis and Machine Intelligence% ##24(3)#: 381\\--396.")
  380. MAN_END
  381. MAN_BEGIN (U"Rabiner (1989)", U"djmw", 20101017)
  382. NORMAL (U"L.R. Rabiner (1989): \"A tutorial on Hidden Markov Models and selected applications in speech recognition.\" %%Proceedings of the IEEE% #77: 257\\--286.")
  383. MAN_END
  384. MAN_BEGIN (U"Tenreiro (2009)", U"djmw", 20101113)
  385. NORMAL (U"C. Tenreiro (2009): \"On the choice of the smoothing parameter for the BHEP goodness-of-fit test.\" "
  386. "%%Computational Statistics and Data Analysis% #53: 1038\\--1053.")
  387. MAN_END
  388. MAN_BEGIN (U"Zhang et al. (2003)", U"djmw", 20101122)
  389. NORMAL (U"Zhihua Zhang & Chibiao Chen & Jian Sun & Kap Luk Chan (2003): \"EM algorithms for Gaussian mixtures with "
  390. "split-and-merge operation.\" %%Pattern Recognition% #36: 1973\\--1983.")
  391. MAN_END
  392. }
  393. /* End of file manual_HMM.cpp */