Edinburgh Speech Tools  2.4-release
 All Classes Functions Variables Typedefs Enumerations Enumerator Friends Pages
EST_dynamic_model.h
1 /*************************************************************************/
2 /* */
3 /* Centre for Speech Technology Research */
4 /* University of Edinburgh, UK */
5 /* Copyright (c) 1995,1996 */
6 /* All Rights Reserved. */
7 /* */
8 /* Permission is hereby granted, free of charge, to use and distribute */
9 /* this software and its documentation without restriction, including */
10 /* without limitation the rights to use, copy, modify, merge, publish, */
11 /* distribute, sublicense, and/or sell copies of this work, and to */
12 /* permit persons to whom this work is furnished to do so, subject to */
13 /* the following conditions: */
14 /* 1. The code must retain the above copyright notice, this list of */
15 /* conditions and the following disclaimer. */
16 /* 2. Any modifications must be clearly marked as such. */
17 /* 3. Original authors' names are not deleted. */
18 /* 4. The authors' names are not used to endorse or promote products */
19 /* derived from this software without specific prior written */
20 /* permission. */
21 /* */
22 /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */
23 /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */
24 /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */
25 /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */
26 /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */
27 /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */
28 /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */
29 /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */
30 /* THIS SOFTWARE. */
31 /* */
32 /*************************************************************************/
33 /* Author : Simon King */
34 /* Date : June 1998 */
35 /*-----------------------------------------------------------------------*/
36 /* Dynamical models for ASR */
37 /* */
38 /*=======================================================================*/
39 
40 #include <cstdlib>
41 #include <stdio.h>
42 #include <fstream.h>
43 #include "EST.h"
44 #include "EST_model_types.h"
45 
46 // for now, CSMM means continuous-state Markov model
47 class CSMM
48 {
49 public:
56  refcounted_EST_DVectorP mean_initial_x;
57  stats_accumulator stats;
58 };
59 
60 bool operator ==(const CSMM &, const CSMM &);
61 ostream& operator <<(ostream &s, const CSMM &);
62 
63 /// somewhere to keep the model parameters
65 {
68 };
69 
70 /// somewhere to keep the models
71 struct CSMM_set
72 {
73  EST_TKVL<EST_String,CSMM> model_set;
74  CSMM_parameter_set parameter_set;
75 };
76 
77 
78 
79 ostream& operator <<(ostream &s, const CSMM_set &ms);
80 
81 bool
82 create_empty_CSMM(EST_String model_name,
83  CSMM_set &model_set,
84  const int model_order,
85  const int observation_order);
86 
87 /// at last, some interesting functions
88 bool
89 E_step(CSMM &model,
90  EST_DMatrix &mean_initial_covar_x,
91  const EST_TrackList &train_data,
92  const bool trace);
93 bool
94 M_step(CSMM &model,
95  const bool trace);
96 bool
97 EM_shared_hidden_space(CSMM_set &models,
98  const int model_order,
99  EST_DMatrix &mean_initial_covar_x,
100  const EST_TrackList &train_data,
101  const int iterations,
102  const bool trace);
103 EST_write_status
104 save_CSMM_set(CSMM_set &model_set, const EST_String &dirname, const EST_String &type);
105 
106 EST_read_status
107 load_CSMM_set(CSMM_set &model_set, const EST_String &dirname);
108 
109 double
110 CSMM_Mahalanobis_distance(const CSMM &model, const EST_Track &t);