mlpack  master
ada_delta.hpp
Go to the documentation of this file.
1 
15 #ifndef __MLPACK_CORE_OPTIMIZERS_ADADELTA_ADA_DELTA_HPP
16 #define __MLPACK_CORE_OPTIMIZERS_ADADELTA_ADA_DELTA_HPP
17 
18 #include <mlpack/prereqs.hpp>
19 
20 namespace mlpack {
21 namespace optimization {
22 
62 template<typename DecomposableFunctionType>
63 class AdaDelta
64 {
65  public:
83  AdaDelta(DecomposableFunctionType& function,
84  const double rho = 0.95,
85  const double eps = 1e-6,
86  const size_t maxIterations = 100000,
87  const double tolerance = 1e-5,
88  const bool shuffle = true);
89 
98  double Optimize(arma::mat& iterate);
99 
101  const DecomposableFunctionType& Function() const { return function; }
103  DecomposableFunctionType& Function() { return function; }
104 
106  double Rho() const { return rho; }
108  double& Rho() { return rho; }
109 
111  double Epsilon() const { return eps; }
113  double& Epsilon() { return eps; }
114 
116  size_t MaxIterations() const { return maxIterations; }
118  size_t& MaxIterations() { return maxIterations; }
119 
121  double Tolerance() const { return tolerance; }
123  double& Tolerance() { return tolerance; }
124 
126  bool Shuffle() const { return shuffle; }
128  bool& Shuffle() { return shuffle; }
129 
130  private:
132  DecomposableFunctionType& function;
133 
135  double rho;
136 
138  double eps;
139 
142 
144  double tolerance;
145 
148  bool shuffle;
149 };
150 
151 } // namespace optimization
152 } // namespace mlpack
153 
154 // Include implementation.
155 #include "ada_delta_impl.hpp"
156 
157 #endif
158 
DecomposableFunctionType & Function()
Modify the instantiated function.
Definition: ada_delta.hpp:103
double tolerance
The tolerance for termination.
Definition: ada_delta.hpp:144
Adadelta is an optimizer that uses two ideas to improve upon the two main drawbacks of the Adagrad me...
Definition: ada_delta.hpp:63
Linear algebra utility functions, generally performed on matrices or vectors.
Definition: binarize.hpp:18
double & Rho()
Modify the smoothing parameter.
Definition: ada_delta.hpp:108
double & Tolerance()
Modify the tolerance for termination.
Definition: ada_delta.hpp:123
The core includes that mlpack expects; standard C++ includes and Armadillo.
size_t maxIterations
The maximum number of allowed iterations.
Definition: ada_delta.hpp:141
double eps
The value used to initialise the mean squared gradient parameter.
Definition: ada_delta.hpp:138
double Epsilon() const
Get the value used to initialise the mean squared gradient parameter.
Definition: ada_delta.hpp:111
size_t MaxIterations() const
Get the maximum number of iterations (0 indicates no limit).
Definition: ada_delta.hpp:116
size_t & MaxIterations()
Modify the maximum number of iterations (0 indicates no limit).
Definition: ada_delta.hpp:118
double & Epsilon()
Modify the value used to initialise the mean squared gradient parameter.
Definition: ada_delta.hpp:113
double rho
The smoothing parameter.
Definition: ada_delta.hpp:135
double Tolerance() const
Get the tolerance for termination.
Definition: ada_delta.hpp:121
bool & Shuffle()
Modify whether or not the individual functions are shuffled.
Definition: ada_delta.hpp:128
const DecomposableFunctionType & Function() const
Get the instantiated function to be optimized.
Definition: ada_delta.hpp:101
bool shuffle
Controls whether or not the individual functions are shuffled when iterating.
Definition: ada_delta.hpp:148
double Rho() const
Get the smoothing parameter.
Definition: ada_delta.hpp:106
bool Shuffle() const
Get whether or not the individual functions are shuffled.
Definition: ada_delta.hpp:126
double Optimize(arma::mat &iterate)
Optimize the given function using AdaDelta.
AdaDelta(DecomposableFunctionType &function, const double rho=0.95, const double eps=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.