combine-nnet-a.h
Go to the documentation of this file.
1 // nnet2/combine-nnet-a.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 #ifndef KALDI_NNET2_COMBINE_NNET_A_H_
21 #define KALDI_NNET2_COMBINE_NNET_A_H_
22 
23 #include "nnet2/nnet-update.h"
24 #include "nnet2/nnet-compute.h"
25 #include "util/parse-options.h"
26 #include "itf/options-itf.h"
27 
28 namespace kaldi {
29 namespace nnet2 {
30 
32  int32 num_bfgs_iters; // The dimension is small (the number of layers)
33  // so we do BFGS. Note: this num-iters is really the number of function
34  // evaluations.
35 
37 
40 
41  BaseFloat min_learning_rate_factor; // 0.5 by default;
42  BaseFloat max_learning_rate_factor; // 2.0 by default.
43  BaseFloat min_learning_rate; // 0.0001 by default; we don't allow learning rate to go below
44  // this, mainly because it would lead to roundoff problems.
45 
46  NnetCombineAconfig(): num_bfgs_iters(15), initial_step(0.1),
47  valid_impr_thresh(0.5), overshoot(1.8),
48  min_learning_rate_factor(0.5),
49  max_learning_rate_factor(2.0),
50  min_learning_rate(0.0001) { }
51 
52  void Register(OptionsItf *opts) {
53  opts->Register("num-bfgs-iters", &num_bfgs_iters, "Maximum number of function "
54  "evaluations for BFGS to use when optimizing combination weights");
55  opts->Register("initial-step", &initial_step, "Parameter in the optimization, "
56  "used to set the initial step length; the default value should be "
57  "suitable.");
58  opts->Register("num-bfgs-iters", &num_bfgs_iters, "Maximum number of function "
59  "evaluations for BFGS to use when optimizing combination weights");
60  opts->Register("valid-impr-thresh", &valid_impr_thresh, "Threshold of improvement "
61  "in validation-set objective function for one iteratin; below this, "
62  "we start using the \"overshoot\" mechanism to keep learning rates high.");
63  opts->Register("overshoot", &overshoot, "Factor by which we overshoot the step "
64  "size obtained by BFGS; only applies when validation set impr is less "
65  "than valid-impr-thresh.");
66  opts->Register("max-learning-rate-factor", &max_learning_rate_factor,
67  "Maximum factor by which to increase the learning rate for any layer.");
68  opts->Register("min-learning-rate-factor", &min_learning_rate_factor,
69  "Minimum factor by which to increase the learning rate for any layer.");
70  opts->Register("min-learning-rate", &min_learning_rate,
71  "Floor on the automatically updated learning rates");
72  }
73 };
74 
75 void CombineNnetsA(const NnetCombineAconfig &combine_config,
76  const std::vector<NnetExample> &validation_set,
77  const std::vector<Nnet> &nnets_in,
78  Nnet *nnet_out);
79 
80 
81 
82 } // namespace nnet2
83 } // namespace kaldi
84 
85 #endif
This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
Definition: chain.dox:20
void CombineNnetsA(const NnetCombineAconfig &config, const std::vector< NnetExample > &validation_set, const std::vector< Nnet > &nnets, Nnet *nnet_out)
kaldi::int32 int32
virtual void Register(const std::string &name, bool *ptr, const std::string &doc)=0
This header provides functionality for sample-by-sample stochastic gradient descent and gradient comp...
void Register(OptionsItf *opts)