18 #ifndef MLPACK_CORE_OPTIMIZERS_ADAM_ADAMAX_UPDATE_HPP 19 #define MLPACK_CORE_OPTIMIZERS_ADAM_ADAMAX_UPDATE_HPP 24 namespace optimization {
56 const double beta1 = 0.9,
57 const double beta2 = 0.999) :
75 m = arma::zeros<arma::mat>(rows, cols);
76 u = arma::zeros<arma::mat>(rows, cols);
87 const double stepSize,
88 const arma::mat& gradient)
95 m += (1 - beta1) * gradient;
99 u = arma::max(u, arma::abs(gradient));
101 const double biasCorrection1 = 1.0 - std::pow(beta1, iteration);
103 if (biasCorrection1 != 0)
104 iterate -= (stepSize / biasCorrection1 * m / (u + epsilon));
113 double Beta1()
const {
return beta1; }
118 double Beta2()
const {
return beta2; }
void Update(arma::mat &iterate, const double stepSize, const arma::mat &gradient)
Update step for Adam.
double Epsilon() const
Get the value used to initialise the squared gradient parameter.
double & Beta2()
Modify the second moment coefficient.
The core includes that mlpack expects; standard C++ includes and Armadillo.
double Beta2() const
Get the second moment coefficient.
double Beta1() const
Get the smoothing parameter.
AdaMaxUpdate(const double epsilon=1e-8, const double beta1=0.9, const double beta2=0.999)
Construct the AdaMax update policy with the given parameters.
double & Beta1()
Modify the smoothing parameter.
AdaMax is a variant of Adam, an optimizer that computes individual adaptive learning rates for differ...
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...
double & Epsilon()
Modify the value used to initialise the squared gradient parameter.