12 #ifndef MLPACK_CORE_OPTIMIZERS_ADA_GRAD_ADA_GRAD_UPDATE_HPP 13 #define MLPACK_CORE_OPTIMIZERS_ADA_GRAD_ADA_GRAD_UPDATE_HPP 18 namespace optimization {
67 squaredGradient = arma::zeros<arma::mat>(rows, cols);
80 const double stepSize,
81 const arma::mat& gradient)
83 squaredGradient += (gradient % gradient);
84 iterate -= (stepSize * gradient) / (arma::sqrt(squaredGradient) + epsilon);
88 double Epsilon()
const {
return epsilon; }
97 arma::mat squaredGradient;
The core includes that mlpack expects; standard C++ includes and Armadillo.
void Initialize(const size_t rows, const size_t cols)
The Initialize method is called by SGD Optimizer method before the start of the iteration update proc...
Implementation of the AdaGrad update policy.
double & Epsilon()
Modify the value used to initialise the squared gradient parameter.
AdaGradUpdate(const double epsilon=1e-8)
Construct the AdaGrad update policy with given epsilon parameter.
double Epsilon() const
Get the value used to initialise the squared gradient parameter.
void Update(arma::mat &iterate, const double stepSize, const arma::mat &gradient)
Update step for SGD.