vanilla_update.hpp
Go to the documentation of this file.
1 
12 #ifndef MLPACK_CORE_OPTIMIZERS_SGD_EMPTY_UPDATE_HPP
13 #define MLPACK_CORE_OPTIMIZERS_SGD_EMPTY_UPDATE_HPP
14 
15 #include <mlpack/prereqs.hpp>
16 
17 namespace mlpack {
18 namespace optimization {
19 
32 {
33  public:
42  void Initialize(const size_t /* rows */, const size_t /* cols */)
43  { /* Do nothing. */ }
44 
53  void Update(arma::mat& iterate,
54  const double stepSize,
55  const arma::mat& gradient)
56  {
57  // Perform the vanilla SGD update.
58  iterate -= stepSize * gradient;
59  }
60 };
61 
62 } // namespace optimization
63 } // namespace mlpack
64 
65 #endif
Vanilla update policy for Stochastic Gradient Descent (SGD).
.hpp
Definition: add_to_po.hpp:21
The core includes that mlpack expects; standard C++ includes and Armadillo.
void Initialize(const size_t, const size_t)
The Initialize method is called by SGD Optimizer method before the start of the iteration update proc...
void Update(arma::mat &iterate, const double stepSize, const arma::mat &gradient)
Update step for SGD.