shrink-nnet.h
Go to the documentation of this file.
1 // nnet2/shrink-nnet.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_SHRINK_NNET_H_
21 #define KALDI_NNET2_SHRINK_NNET_H_
22 
23 #include "nnet2/nnet-update.h"
24 #include "nnet2/nnet-compute.h"
25 #include "itf/options-itf.h"
26 
27 namespace kaldi {
28 namespace nnet2 {
29 
34  int32 num_bfgs_iters; // The dimension is small (e.g. 3 to 5) so we do
35  // BFGS. We actually implement this as L-BFGS but setting the number of
36  // vectors to be the same as the dimension of the space. Note: this
37  // num-iters is in reality the number of function evaluations.
38 
40 
41  NnetShrinkConfig(): num_bfgs_iters(10), initial_step(0.1) { }
42  void Register(OptionsItf *opts) {
43  opts->Register("num-bfgs-iters", &num_bfgs_iters, "Number of iterations of "
44  "BFGS to use when optimizing shrinkage parameters");
45  opts->Register("initial-step", &initial_step, "Parameter in the optimization, "
46  "used to set the initial step length");
47  }
48 };
49 
50 void ShrinkNnet(const NnetShrinkConfig &shrink_config,
51  const std::vector<NnetExample> &validation_set,
52  Nnet *nnet);
53 
54 
55 
56 } // namespace nnet2
57 } // namespace kaldi
58 
59 #endif
This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
Definition: chain.dox:20
kaldi::int32 int32
virtual void Register(const std::string &name, bool *ptr, const std::string &doc)=0
Configuration class that controls neural net "shrinkage" which is actually a scaling on the parameter...
Definition: shrink-nnet.h:33
void Register(OptionsItf *opts)
Definition: shrink-nnet.h:42
void ShrinkNnet(const NnetShrinkConfig &shrink_config, const std::vector< NnetExample > &validation_set, Nnet *nnet)
Definition: shrink-nnet.cc:66
This header provides functionality for sample-by-sample stochastic gradient descent and gradient comp...