exponential_backoff.hpp
Go to the documentation of this file.
1 
13 #ifndef MLPACK_CORE_OPTIMIZERS_PARALLEL_SGD_EXP_BACKOFF_HPP
14 #define MLPACK_CORE_OPTIMIZERS_PARALLEL_SGD_EXP_BACKOFF_HPP
15 
16 #include <mlpack/prereqs.hpp>
17 
18 namespace mlpack {
19 namespace optimization {
20 
39 {
40  public:
50  ExponentialBackoff(const size_t firstBackoffEpoch,
51  const double step,
52  const double beta) :
53  firstBackoffEpoch(firstBackoffEpoch),
54  cutoffEpoch(firstBackoffEpoch),
55  step(step),
56  beta(beta)
57  { /* Nothing to do. */ }
58 
65  double StepSize(const size_t numEpoch)
66  {
67  if (numEpoch >= cutoffEpoch)
68  {
69  step *= beta;
70  cutoffEpoch += firstBackoffEpoch / beta;
71  }
72  return step;
73  }
74 
75  private:
77  size_t firstBackoffEpoch;
78 
80  size_t cutoffEpoch;
81 
83  double step;
84 
86  double beta;
87 };
88 
89 } // namespace optimization
90 } // namespace mlpack
91 
92 #endif
double StepSize(const size_t numEpoch)
Get the step size for the current gradient update.
.hpp
Definition: add_to_po.hpp:21
The core includes that mlpack expects; standard C++ includes and Armadillo.
Exponential backoff stepsize reduction policy for parallel SGD.
ExponentialBackoff(const size_t firstBackoffEpoch, const double step, const double beta)
Member initializer constructor to construct the exponential backoff policy with the required paramete...