13 #ifndef MLPACK_CORE_OPTIMIZERS_ADA_DELTA_UPDATE_HPP 14 #define MLPACK_CORE_OPTIMIZERS_ADA_DELTA_UPDATE_HPP 19 namespace optimization {
70 meanSquaredGradient = arma::zeros<arma::mat>(rows, cols);
71 meanSquaredGradientDx = arma::zeros<arma::mat>(rows, cols);
84 const double stepSize,
85 const arma::mat& gradient)
88 meanSquaredGradient *= rho;
89 meanSquaredGradient += (1 - rho) * (gradient % gradient);
90 arma::mat dx = arma::sqrt((meanSquaredGradientDx + epsilon) /
91 (meanSquaredGradient + epsilon)) % gradient;
94 meanSquaredGradientDx *= rho;
95 meanSquaredGradientDx += (1 - rho) * (dx % dx);
98 iterate -= (stepSize * dx);
102 double Rho()
const {
return rho; }
104 double&
Rho() {
return rho; }
119 arma::mat meanSquaredGradient;
122 arma::mat meanSquaredGradientDx;
The core includes that mlpack expects; standard C++ includes and Armadillo.
double & Epsilon()
Modify the value used to initialise the mean squared gradient parameter.
Implementation of the AdaDelta update policy.
void Update(arma::mat &iterate, const double stepSize, const arma::mat &gradient)
Update step for SGD.
double Epsilon() const
Get the value used to initialise the mean squared gradient parameter.
double & Rho()
Modify the smoothing parameter.
AdaDeltaUpdate(const double rho=0.95, const double epsilon=1e-6)
Construct the AdaDelta update policy with given rho and epsilon parameters.
double Rho() const
Get the smoothing parameter.
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...