14 #ifndef MLPACK_CORE_OPTIMIZERS_ADA_GRAD_ADA_GRAD_HPP
15 #define MLPACK_CORE_OPTIMIZERS_ADA_GRAD_ADA_GRAD_HPP
22 namespace optimization {
84 AdaGrad(
const double stepSize = 0.01,
85 const size_t batchSize = 32,
86 const double epsilon = 1e-8,
87 const size_t maxIterations = 100000,
88 const double tolerance = 1e-5,
89 const bool shuffle =
true);
101 template<
typename DecomposableFunctionType>
102 double Optimize(DecomposableFunctionType&
function, arma::mat& iterate)
104 return optimizer.Optimize(
function, iterate);
108 double StepSize()
const {
return optimizer.StepSize(); }
110 double&
StepSize() {
return optimizer.StepSize(); }
113 size_t BatchSize()
const {
return optimizer.BatchSize(); }
118 double Epsilon()
const {
return optimizer.UpdatePolicy().Epsilon(); }
120 double&
Epsilon() {
return optimizer.UpdatePolicy().Epsilon(); }
128 double Tolerance()
const {
return optimizer.Tolerance(); }
133 bool Shuffle()
const {
return optimizer.Shuffle(); }
135 bool&
Shuffle() {
return optimizer.Shuffle(); }
double Optimize(DecomposableFunctionType &function, arma::mat &iterate)
Optimize the given function using AdaGrad.
bool Shuffle() const
Get whether or not the individual functions are shuffled.
double & Epsilon()
Modify the value used to initialise the squared gradient parameter.
The core includes that mlpack expects; standard C++ includes and Armadillo.
double & Tolerance()
Modify the tolerance for termination.
double & StepSize()
Modify the step size.
size_t & BatchSize()
Modify the batch size.
AdaGrad(const double stepSize=0.01, const size_t batchSize=32, const double epsilon=1e-8, const size_t maxIterations=100000, const double tolerance=1e-5, const bool shuffle=true)
Construct the AdaGrad optimizer with the given function and parameters.
double StepSize() const
Get the step size.
AdaGrad is a modified version of stochastic gradient descent which performs larger updates for more s...
Stochastic Gradient Descent is a technique for minimizing a function which can be expressed as a sum ...
double Tolerance() const
Get the tolerance for termination.
bool & Shuffle()
Modify whether or not the individual functions are shuffled.
size_t MaxIterations() const
Get the maximum number of iterations (0 indicates no limit).
size_t & MaxIterations()
Modify the maximum number of iterations (0 indicates no limit).
double Epsilon() const
Get the value used to initialise the squared gradient parameter.
size_t BatchSize() const
Get the batch size.