Debian Codegraph @

dwtools/HMM.h

raw symbols SCIP
1 #cxx . . $ `<file>/dwtools/HMM.h`/ifndef _HMM_h_
2 #define _HMM_h_cxx . . $ `dwtools/HMM.h:2:9`!
3 /* HMM.h
4 *
5 * Copyright (C) 2010-2019, 2023 David Weenink
6 *
7 * This code is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or (at
10 * your option) any later version.
11 *
12 * This code is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this work. If not, see <http://www.gnu.org/licenses/>.
19 */
20
21 #include "Strings_extensions.h"cxx . . $ `<file>/dwtools/Strings_extensions.h`/
22 #include "TableOfReal.h"cxx . . $ `<file>/stat/TableOfReal.h`/
23 #include "Collection.h"cxx . . $ `<file>/sys/Collection.h`/
24 #include "GaussianMixture.h"cxx . . $ `<file>/dwtools/GaussianMixture.h`/
25 #include "SSCP.h"cxx . . $ `<file>/dwtools/SSCP.h`/
26 #include "Index.h"cxx . . $ `<file>/dwsys/Index.h`/
27
28
29 Thing_declarecxx . . $ HMMStateListHandle# (HMMStateList);
30 Thing_declarecxx . . $ autoSomeThing# (HMMObservationList);
31
32 #include "HMM_enums.h"cxx . . $ `<file>/dwtools/HMM_enums.h`/
33
34 #include "HMM_def.h"cxx . . $ `<file>/dwtools/HMM_def.h`/
35
36 /********** class HMMStateList **********/
37
38 Collection_definecxx . . $ `sys/Collection.h:786:9`! (HMMStateList, OrderedOf, HMMState) {
39 };
40
41 /********** class HMMObservationList **********/
42
43 Collection_definecxx . . $ structHMMObservationList# (HMMObservationList, OrderedOf, HMMObservation) {
44 };
45
46 /********** class HMMBaumWelch **********/
47
48 Thing_definecxx . . $ SomeThingHandle# (HMMBaumWelch, Daata) {
49 integercxx . . $ integer# capacitycxx . . $ structHMMBaumWelch#capacity.;
50 integercxx . . $ integer# numberOfTimescxx . . $ structHMMBaumWelch#numberOfTimes.;
51 integercxx . . $ integer# totalNumberOfSequencescxx . . $ structHMMBaumWelch#totalNumberOfSequences.;
52 integercxx . . $ integer# numberOfStatescxx . . $ structHMMBaumWelch#numberOfStates.;
53 integercxx . . $ integer# numberOfSymbolscxx . . $ structHMMBaumWelch#numberOfSymbols.;
54 double lnProbcxx . . $ structHMMBaumWelch#lnProb.;
55 double minProbcxx . . $ structHMMBaumWelch#minProb.;
56 autoMATcxx . . $ autoMAT# alphacxx . . $ structHMMBaumWelch#alpha.;
57 autoMATcxx . . $ autoMAT# betacxx . . $ structHMMBaumWelch#beta.;
58 autoVECcxx . . $ autoVEC# scalecxx . . $ structHMMBaumWelch#scale.;
59 autoMATcxx . . $ autoMAT# gammacxx . . $ structHMMBaumWelch#gamma.;
60 autoTEN3cxx . . $ autoTEN3# xicxx . . $ structHMMBaumWelch#xi.;
61 autoVECcxx . . $ autoVEC# aij_num_p0cxx . . $ structHMMBaumWelch#aij_num_p0.;
62 autoMATcxx . . $ autoMAT# aij_numcxx . . $ structHMMBaumWelch#aij_num.;
63 autoVECcxx . . $ autoVEC# aij_denom_p0cxx . . $ structHMMBaumWelch#aij_denom_p0.;
64 autoMATcxx . . $ autoMAT# aij_denomcxx . . $ structHMMBaumWelch#aij_denom.;
65 autoMATcxx . . $ autoMAT# bik_numcxx . . $ structHMMBaumWelch#bik_num.;
66 autoMATcxx . . $ autoMAT# bik_denomcxx . . $ structHMMBaumWelch#bik_denom.;
67 };
68
69 Thing_definecxx . . $ classHMMStateSequence. (HMMStateSequence, Strings) {
70 };
71
72 Thing_definecxx . . $ ClassInfo# (HMMObservationSequence, Table) {
73 };
74 // First column is always a symbol, if only 1 column then symbols only
75
76 Collection_definecxx . . $ `sys/Collection.h:786:9`! (HMMObservationSequenceBag, CollectionOf, HMMObservationSequence) {
77 };
78
79 autoHMMObservationSequencecxx . . $ autoHMMObservationSequence# HMMObservationSequence_createcxx . . $ HMMObservationSequence_create(bdb3e019206155cd). (integercxx . . $ integer# numberOfItems, integercxx . . $ integer# dataLength);
80
81 void HMMObservationSequence_removeObservationcxx . . $ HMMObservationSequence_removeObservation(349f1e54c771e9c9). (HMMObservationSequencecxx . . $ HMMObservationSequence# me, integercxx . . $ integer# index);
82
83 autoStringscxx . . $ autoStrings# HMMObservationSequence_to_Stringscxx . . $ HMMObservationSequence_to_Strings(96468204c8f86caf). (HMMObservationSequencecxx . . $ HMMObservationSequence# me);
84
85 autoHMMObservationSequencecxx . . $ autoHMMObservationSequence# Strings_to_HMMObservationSequencecxx . . $ Strings_to_HMMObservationSequence(f78a6c939a57c1f9). (Stringscxx . . $ Strings# me);
86
87 autoStringsIndexcxx . . $ autoStringsIndex# HMMObservationSequence_to_StringsIndexcxx . . $ HMMObservationSequence_to_StringsIndex(4732b0865f9e9dd7). (HMMObservationSequencecxx . . $ HMMObservationSequence# me);
88
89 autoStringsIndexcxx . . $ autoStringsIndex# HMM_HMMObservationSequence_to_StringsIndexcxx . . $ HMM_HMMObservationSequence_to_StringsIndex(ad5f960e0fe6748c). (HMMcxx . . $ HMM# me, HMMObservationSequencecxx . . $ HMMObservationSequence# thee);
90
91 autoTableOfRealcxx . . $ autoTableOfReal# HMMObservationSequence_to_TableOfReal_transitionscxx . . $ HMMObservationSequence_to_TableOfReal_transitions(cc9aa951ca0d805d). (HMMObservationSequencecxx . . $ HMMObservationSequence# me, int probabilities);
92
93 autoTableOfRealcxx . . $ autoTableOfReal# HMM_HMMObservationSequence_to_TableOfReal_transitionscxx . . $ HMM_HMMObservationSequence_to_TableOfReal_transitions(3567f58da6922fc6). (HMMcxx . . $ HMM# me, HMMObservationSequencecxx . . $ HMMObservationSequence# thee, int probabilities);
94
95 integercxx . . $ integer# HMMObservationSequence_getNumberOfObservationscxx . . $ HMMObservationSequence_getNumberOfObservations(60f64ad3800af0f2). (HMMObservationSequencecxx . . $ HMMObservationSequence# me);
96
97 integercxx . . $ integer# HMMObservationSequenceBag_getLongestSequencecxx . . $ HMMObservationSequenceBag_getLongestSequence(79cdb932a9531ff3). (HMMObservationSequenceBagcxx . . $ HMMObservationSequenceBag# me);
98
99 autoTableOfRealcxx . . $ autoTableOfReal# HMMStateSequence_to_TableOfReal_transitionscxx . . $ HMMStateSequence_to_TableOfReal_transitions(bd7a1d7e37d9a9c8). (HMMStateSequencecxx . . $ HMMStateSequence# me);
100
101 autoTableOfRealcxx . . $ autoTableOfReal# HMM_HMMStateSequence_to_TableOfReal_transitionscxx . . $ HMM_HMMStateSequence_to_TableOfReal_transitions(f327171d0faaa012). (HMMcxx . . $ HMM# me, HMMStateSequencecxx . . $ HMMStateSequence# thee, int probabilities);
102
103 autoHMMStateSequencecxx . . $ autoHMMStateSequence# HMMStateSequence_createcxx . . $ HMMStateSequence_create(9c2f169a35e53358). (integercxx . . $ integer# numberOfItems);
104
105 autoStringscxx . . $ autoStrings# HMMStateSequence_to_Stringscxx . . $ HMMStateSequence_to_Strings(ba26850bc1662146). (HMMStateSequencecxx . . $ HMMStateSequence# me);
106
107 void HMMState_setLabelcxx . . $ HMMState_setLabel(32a0f6995fb3042f). (HMMStatecxx . . $ HMMState# me, char32cxx . . $ char32# *label);
108
109
110 autoHMMcxx . . $ autoHMM# HMM_createcxx . . $ HMM_create(cf580d37068cbc4f). (int leftToRight, integercxx . . $ integer# numberOfStates, integercxx . . $ integer# numberOfObservationSymbols);
111
112 autoHMMcxx . . $ autoHMM# HMM_createSimplecxx . . $ HMM_createSimple(2c3c45445b5abe78). (int leftToRight, conststring32cxx . . $ conststring32# states_string, conststring32cxx . . $ conststring32# symbols_string);
113
114 autoHMMcxx . . $ autoHMM# HMM_createContinuousModelcxx . . $ HMM_createContinuousModel(4b9844b0026e562). (int leftToRight, integercxx . . $ integer# numberOfStates, integercxx . . $ integer# numberOfObservationSymbols,
115 integercxx . . $ integer# numberOfMixtureComponentsPerSymbol, integercxx . . $ integer# componentDimension, kHMMstoragecxx . . $ kHMMstorage# componentStorage);
116
117 autoHMMcxx . . $ autoHMM# HMM_createFullContinuousModelcxx . . $ HMM_createFullContinuousModel(ebd09483673e14f6). (int leftToRight, integercxx . . $ integer# numberOfStates, integercxx . . $ integer# numberOfObservationSymbols,
118 integercxx . . $ integer# numberOfFeatureStreams, integercxx . . $ integer# *dimensionOfStream, integercxx . . $ integer# *numberOfGaussiansforStream);
119
120 autoHMMcxx . . $ autoHMM# HMM_createFromHMMObservationSequencecxx . . $ HMM_createFromHMMObservationSequence(4680bdcef32192e6). (HMMObservationSequencecxx . . $ HMMObservationSequence# me, integercxx . . $ integer# numberOfStates, int leftToRight);
121
122 void HMM_drawcxx . . $ HMM_draw(9b70ab1338808ba2). (HMMcxx . . $ HMM# me, Graphicscxx . . $ Graphics# g, bool garnish);
123
124 void HMM_drawBackwardProbabilitiesIllustrationcxx . . $ HMM_drawBackwardProbabilitiesIllustration(b5ae742079ad918c). (Graphicscxx . . $ Graphics# g, bool garnish);
125
126 void HMM_drawForwardProbabilitiesIllustrationcxx . . $ HMM_drawForwardProbabilitiesIllustration(b5ae742079ad918c). (Graphicscxx . . $ Graphics# g, bool garnish);
127
128 void HMM_drawForwardAndBackwardProbabilitiesIllustrationcxx . . $ HMM_drawForwardAndBackwardProbabilitiesIllustration(b5ae742079ad918c). (Graphicscxx . . $ Graphics# g, bool garnish);
129
130 void HMM_addObservation_movecxx . . $ HMM_addObservation_move(146d2ca70b877b86). (HMMcxx . . $ HMM# me, autoHMMObservationcxx . . $ autoHMMObservation# thee);
131
132 void HMM_addState_movecxx . . $ HMM_addState_move(a47c88543731af7f). (HMMcxx . . $ HMM# me, autoHMMStatecxx . . $ autoHMMState# thee);
133
134 void HMM_setDefaultStatescxx . . $ HMM_setDefaultStates(6efb248da18d5537). (HMMcxx . . $ HMM# me);
135
136 void HMM_setDefaultObservationscxx . . $ HMM_setDefaultObservations(6efb248da18d5537). (HMMcxx . . $ HMM# me);
137
138 void HMM_setDefaultTransitionProbscxx . . $ HMM_setDefaultTransitionProbs(6efb248da18d5537). (HMMcxx . . $ HMM# me);
139
140 void HMM_setDefaultInitialStateProbscxx . . $ HMM_setDefaultInitialStateProbs(6efb248da18d5537). (HMMcxx . . $ HMM# me);
141
142 void HMM_setDefaultEmissionProbscxx . . $ HMM_setDefaultEmissionProbs(6efb248da18d5537). (HMMcxx . . $ HMM# me);
143
144 void HMM_setDefaultMixingProbabilitiescxx . . $ HMM_setDefaultMixingProbabilities(6efb248da18d5537). (HMMcxx . . $ HMM# me);
145
146 void HMM_unExpandPCAcxx . . $ HMM_unExpandPCA(6efb248da18d5537). (HMMcxx . . $ HMM# me);
147 /* Unexpand all the PCA's in the gaussian mixtures */
148
149
150
151 /*
152 Set the probabilities. A probability zero value indicates that this p cannot be changed during training/learning.
153 */
154 void HMM_setTransitionProbabilitiescxx . . $ HMM_setTransitionProbabilities(825fcdb86698f8a6). (HMMcxx . . $ HMM# me, integercxx . . $ integer# state_number, constVECVUcxx . . $ constVECVU# const& relativeProbabilities);
155
156 void HMM_setEmissionProbabilitiescxx . . $ HMM_setEmissionProbabilities(825fcdb86698f8a6). (HMMcxx . . $ HMM# me, integercxx . . $ integer# state_number, constVECVUcxx . . $ constVECVU# const& relativeProbabilities);
157
158 void HMM_setStartProbabilitiescxx . . $ HMM_setStartProbabilities(201a3d0dac5ab6fa). (HMMcxx . . $ HMM# me, constVECVUcxx . . $ constVECVU# const& relativeProbabilities);
159
160
161 double HMM_getProbabilityAtTimeBeingInStatecxx . . $ HMM_getProbabilityAtTimeBeingInState(a5dc8f3f179118c1). (HMMcxx . . $ HMM# me, integercxx . . $ integer# itime, integercxx . . $ integer# istate);
162
163 double HMM_getProbabilityAtTimeBeingInStateEmittingSymbolcxx . . $ HMM_getProbabilityAtTimeBeingInStateEmittingSymbol(db68c79978c7f386). (HMMcxx . . $ HMM# me, integercxx . . $ integer# itime, integercxx . . $ integer# istate, integercxx . . $ integer# isymbol);
164
165 double HMM_getExpectedValueOfDurationInStatecxx . . $ HMM_getExpectedValueOfDurationInState(b5d3b510bb3a6f4a). (HMMcxx . . $ HMM# me, integercxx . . $ integer# istate);
166
167 double HMM_getProbabilityOfStayingInStatecxx . . $ HMM_getProbabilityOfStayingInState(a5dc8f3f179118c1). (HMMcxx . . $ HMM# me, integercxx . . $ integer# istate, integercxx . . $ integer# numberOfTimeUnits);
168
169 double HMM_HMM_getCrossEntropycxx . . $ HMM_HMM_getCrossEntropy(e83ce15ac0166a82). (HMMcxx . . $ HMM# me, HMMcxx . . $ HMM# thee, integercxx . . $ integer# observationLength, int symmetric);
170
171 double HMM_HMM_HMMObservationSequence_getCrossEntropycxx . . $ HMM_HMM_HMMObservationSequence_getCrossEntropy(704f2298e8fb2cba). (HMMcxx . . $ HMM# me, HMMcxx . . $ HMM# thee, HMMObservationSequencecxx . . $ HMMObservationSequence# him);
172
173 autoTableOfRealcxx . . $ autoTableOfReal# HMM_extractTransitionProbabilitiescxx . . $ HMM_extractTransitionProbabilities(fc64821279f9062c). (HMMcxx . . $ HMM# me);
174
175 autoTableOfRealcxx . . $ autoTableOfReal# HMM_extractEmissionProbabilitiescxx . . $ HMM_extractEmissionProbabilities(fc64821279f9062c). (HMMcxx . . $ HMM# me);
176
177 /* HMM & HMMObservationSequence ****/
178
179 autoHMMObservationSequencecxx . . $ autoHMMObservationSequence# HMM_to_HMMObservationSequencecxx . . $ HMM_to_HMMObservationSequence(d1c4b4e14e520387). (HMMcxx . . $ HMM# me, integercxx . . $ integer# initialState, integercxx . . $ integer# numberOfItems);
180
181 autoHMMStateSequencecxx . . $ autoHMMStateSequence# HMM_HMMObservationSequence_to_HMMStateSequencecxx . . $ HMM_HMMObservationSequence_to_HMMStateSequence(e3b0918df6c6ca53). (HMMcxx . . $ HMM# me, HMMObservationSequencecxx . . $ HMMObservationSequence# thee);
182
183 double HMM_HMMStateSequence_getProbabilitycxx . . $ HMM_HMMStateSequence_getProbability(76df72986c2263a7). (HMMcxx . . $ HMM# me, HMMStateSequencecxx . . $ HMMStateSequence# thee);
184
185 void HMM_HMMObservationSequenceBag_learncxx . . $ HMM_HMMObservationSequenceBag_learn(ff8bd6789787a46c). (HMMcxx . . $ HMM# me, HMMObservationSequenceBagcxx . . $ HMMObservationSequenceBag# thee, double delta_lnp, double minProb, int info);
186
187 void HMM_HMMStateSequence_drawTrelliscxx . . $ HMM_HMMStateSequence_drawTrellis(91c6c1c881ad593). (HMMcxx . . $ HMM# me, HMMStateSequencecxx . . $ HMMStateSequence# thee, Graphicscxx . . $ Graphics# g, bool connect, bool garnish);
188
189 double HMM_HMMObservationSequence_getProbabilitycxx . . $ HMM_HMMObservationSequence_getProbability(3536ecb89be28e71). (HMMcxx . . $ HMM# me, HMMObservationSequencecxx . . $ HMMObservationSequence# thee);
190
191 double HMM_HMMObservationSequence_getCrossEntropycxx . . $ HMM_HMMObservationSequence_getCrossEntropy(3536ecb89be28e71). (HMMcxx . . $ HMM# me, HMMObservationSequencecxx . . $ HMMObservationSequence# thee);
192
193 double HMM_HMMObservationSequence_getPerplexitycxx . . $ HMM_HMMObservationSequence_getPerplexity(3536ecb89be28e71). (HMMcxx . . $ HMM# me, HMMObservationSequencecxx . . $ HMMObservationSequence# thee);
194
195 // somewhere else
196 void MelderInfo_lnpcxx . . $ MelderInfo_lnp(ba8836b59fb42830). (double logp);
197 autoTableOfRealcxx . . $ autoTableOfReal# Strings_to_TableOfReal_transitionscxx . . $ Strings_to_TableOfReal_transitions(c553ca65e8404f05). (Stringscxx . . $ Strings# me, int probabilities);
198
199 #endif /* _HMM_h_ */