Debian Codegraph @

dwtools/manual_HMM.cpp

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