indirect-diff-diag-gmm.h
Go to the documentation of this file.
1 // gmm/indirect-diff-diag-gmm.h
2 
3 // Copyright 2012 Johns Hopkins University (Author: Daniel Povey)
4 
5 // See ../../COPYING for clarification regarding multiple authors
6 //
7 // Licensed under the Apache License, Version 2.0 (the "License");
8 // you may not use this file except in compliance with the License.
9 // You may obtain a copy of the License at
10 //
11 // http://www.apache.org/licenses/LICENSE-2.0
12 //
13 // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 // KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
15 // WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
16 // MERCHANTABLITY OR NON-INFRINGEMENT.
17 // See the Apache 2 License for the specific language governing permissions and
18 // limitations under the License.
19 
20 
21 #ifndef KALDI_GMM_INDIRECT_DIFF_DIAG_GMM_H_
22 #define KALDI_GMM_INDIRECT_DIFF_DIAG_GMM_H_ 1
23 
24 #include "gmm/diag-gmm.h"
25 #include "gmm/diag-gmm-normal.h"
26 #include "gmm/mle-diag-gmm.h"
27 #include "gmm/mle-am-diag-gmm.h"
28 #include "gmm/model-common.h"
29 
30 namespace kaldi {
31 
32 // This gets the derivative of the (MMI or MPE) objective function w.r.t. the
33 // statistics for ML update, assuming we're doing an ML update-- as described in
34 // the original fMPE paper. This is used in fMPE/fMMI, for the "indirect
35 // differential". This derivative is represented as class AccumDiagGmm, as
36 // derivatives w.r.t. the x and x^2 stats directly (not w.r.t. the mean and
37 // variance).
38 //
39 // If the parameter "rescaling" is true, this function will assume that instead
40 // of the ML update, you will do a "rescaling" update as in the function
41 // DoRescalingUpdate().
42 //
43 // CAUTION: for fMPE (as opposed to fMMI), to get the right answer, you would have
44 // to pre-scale the num and den accs by the acoustic scale (e.g. 0.1).
45 void GetStatsDerivative(const AmDiagGmm &gmm,
46  const AccumAmDiagGmm &num_accs, // for MMI, would equal ml accs.
47  const AccumAmDiagGmm &den_accs,
48  const AccumAmDiagGmm &ml_accs,
49  BaseFloat min_variance,
50  BaseFloat min_gaussian_occupancy,
51  AccumAmDiagGmm *out_accs);
52 
53 
54 // This function "DoRescalingUpdate" updates the GMMs in a special way-- it
55 // first works out how the Gaussians differ from the old stats (in terms of an
56 // offset on the mean, a scale on the variance, and a factor on the weights),
57 // and it updates the model so that it will differ in the same way from the new
58 // stats.
59 //
60 // The idea here is that the original model may have been discriminatively
61 // trained, but we may have changed the features or the domain or something
62 // of that nature, and we want to update the model but preserve the discriminative
63 // training (viewed as an offset).
64 void DoRescalingUpdate(const AccumAmDiagGmm &old_ml_accs,
65  const AccumAmDiagGmm &new_ml_accs,
66  BaseFloat min_variance,
67  BaseFloat min_gaussian_occupancy,
68  AmDiagGmm *gmm);
69 
70 
71 } // end namespace kaldi
72 
73 
74 #endif // KALDI_GMM_INDIRECT_DIFF_DIAG_GMM_H_
This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
Definition: chain.dox:20
float BaseFloat
Definition: kaldi-types.h:29
void GetStatsDerivative(const DiagGmm &gmm, const AccumDiagGmm &num_acc, const AccumDiagGmm &den_acc, const AccumDiagGmm &ml_acc, BaseFloat min_variance, BaseFloat min_gaussian_occupancy, AccumDiagGmm *out_accs)
void DoRescalingUpdate(const AccumDiagGmm &old_ml_acc, const AccumDiagGmm &new_ml_acc, BaseFloat min_variance, BaseFloat min_gaussian_occupancy, DiagGmm *gmm, double *tot_count, double *tot_divergence)