ada_delta.hpp
Go to the documentation of this file.
1 
16 #ifndef MLPACK_CORE_OPTIMIZERS_ADA_DELTA_ADA_DELTA_HPP
17 #define MLPACK_CORE_OPTIMIZERS_ADA_DELTA_ADA_DELTA_HPP
18 
19 #include <mlpack/prereqs.hpp>
21 #include "ada_delta_update.hpp"
22 
23 namespace mlpack {
24 namespace optimization {
25 
64 class AdaDelta
65 {
66  public:
86  AdaDelta(const double stepSize = 1.0,
87  const size_t batchSize = 32,
88  const double rho = 0.95,
89  const double epsilon = 1e-6,
90  const size_t maxIterations = 100000,
91  const double tolerance = 1e-5,
92  const bool shuffle = true);
93 
105  template<typename DecomposableFunctionType>
106  double Optimize(DecomposableFunctionType& function, arma::mat& iterate)
107  {
108  return optimizer.Optimize(function, iterate);
109  }
110 
112  double StepSize() const { return optimizer.StepSize(); }
114  double& StepSize() { return optimizer.StepSize(); }
115 
117  size_t BatchSize() const { return optimizer.BatchSize(); }
119  size_t& BatchSize() { return optimizer.BatchSize(); }
120 
122  double Rho() const { return optimizer.UpdatePolicy().Rho(); }
124  double& Rho() { return optimizer.UpdatePolicy().Rho(); }
125 
127  double Epsilon() const { return optimizer.UpdatePolicy().Epsilon(); }
129  double& Epsilon() { return optimizer.UpdatePolicy().Epsilon(); }
130 
132  size_t MaxIterations() const { return optimizer.MaxIterations(); }
134  size_t& MaxIterations() { return optimizer.MaxIterations(); }
135 
137  double Tolerance() const { return optimizer.Tolerance(); }
139  double& Tolerance() { return optimizer.Tolerance(); }
140 
142  bool Shuffle() const { return optimizer.Shuffle(); }
144  bool& Shuffle() { return optimizer.Shuffle(); }
145 
146  private:
148  SGD<AdaDeltaUpdate> optimizer;
149 };
150 
151 } // namespace optimization
152 } // namespace mlpack
153 
154 #endif
AdaDelta is an optimizer that uses two ideas to improve upon the two main drawbacks of the Adagrad me...
Definition: ada_delta.hpp:64
AdaDelta(const double stepSize=1.0, const size_t batchSize=32, const double rho=0.95, const double epsilon=1e-6, const size_t maxIterations=100000, const double tolerance=1e-5, const bool shuffle=true)
Construct the AdaDelta optimizer with the given function and parameters.
.hpp
Definition: add_to_po.hpp:21
The core includes that mlpack expects; standard C++ includes and Armadillo.
double Rho() const
Get the smoothing parameter.
Definition: ada_delta.hpp:122
double Epsilon() const
Get the value used to initialise the mean squared gradient parameter.
Definition: ada_delta.hpp:127
size_t MaxIterations() const
Get the maximum number of iterations (0 indicates no limit).
Definition: ada_delta.hpp:132
double & Rho()
Modify the smoothing parameter.
Definition: ada_delta.hpp:124
bool Shuffle() const
Get whether or not the individual functions are shuffled.
Definition: ada_delta.hpp:142
size_t & BatchSize()
Modify the batch size.
Definition: ada_delta.hpp:119
double Tolerance() const
Get the tolerance for termination.
Definition: ada_delta.hpp:137
double & Tolerance()
Modify the tolerance for termination.
Definition: ada_delta.hpp:139
size_t & MaxIterations()
Modify the maximum number of iterations (0 indicates no limit).
Definition: ada_delta.hpp:134
bool & Shuffle()
Modify whether or not the individual functions are shuffled.
Definition: ada_delta.hpp:144
Stochastic Gradient Descent is a technique for minimizing a function which can be expressed as a sum ...
Definition: sgd.hpp:86
double Optimize(DecomposableFunctionType &function, arma::mat &iterate)
Optimize the given function using AdaDelta.
Definition: ada_delta.hpp:106
size_t BatchSize() const
Get the batch size.
Definition: ada_delta.hpp:117
double & StepSize()
Modify the step size.
Definition: ada_delta.hpp:114
double StepSize() const
Get the step size.
Definition: ada_delta.hpp:112
double & Epsilon()
Modify the value used to initialise the mean squared gradient parameter.
Definition: ada_delta.hpp:129