12 #ifndef MLPACK_CORE_OPTIMIZERS_SMORMS3_SMORMS3_UPDATE_HPP 13 #define MLPACK_CORE_OPTIMIZERS_SMORMS3_SMORMS3_UPDATE_HPP 18 namespace optimization {
59 mem = arma::ones<arma::mat>(rows, cols);
60 g = arma::zeros<arma::mat>(rows, cols);
61 g2 = arma::zeros<arma::mat>(rows, cols);
72 const double stepSize,
73 const arma::mat& gradient)
76 arma::mat r = 1 / (mem + 1);
82 g2 += r % (gradient % gradient);
84 arma::mat x = (g % g) / (g2 + epsilon);
86 x.transform( [stepSize](
double &v) {
return std::min(v, stepSize); } );
88 iterate -= gradient % x / (arma::sqrt(g2) + epsilon);
95 double Epsilon()
const {
return epsilon; }
104 arma::mat mem, g, g2;
SMORMS3 is an optimizer that estimates a safe and optimal distance based on curvature and normalizing...
SMORMS3Update(const double epsilon=1e-16)
Construct the SMORMS3 update policy with given epsilon parameter.
The core includes that mlpack expects; standard C++ includes and Armadillo.
void Update(arma::mat &iterate, const double stepSize, const arma::mat &gradient)
Update step for SMORMS3.
double & Epsilon()
Modify the value used to initialise the mean squared gradient parameter.
void Initialize(const size_t rows, const size_t cols)
The Initialize method is called by SGD::Optimize method with UpdatePolicy SMORMS3Update before the st...
double Epsilon() const
Get the value used to initialise the mean squared gradient parameter.