rmsprop.hpp
Go to the documentation of this file.
1 
15 #ifndef MLPACK_CORE_OPTIMIZERS_RMSPROP_RMSPROP_HPP
16 #define MLPACK_CORE_OPTIMIZERS_RMSPROP_RMSPROP_HPP
17 
18 #include <mlpack/prereqs.hpp>
19 
21 #include "rmsprop_update.hpp"
22 
23 namespace mlpack {
24 namespace optimization {
25 
67 class RMSProp
68 {
69  public:
89  RMSProp(const double stepSize = 0.01,
90  const size_t batchSize = 32,
91  const double alpha = 0.99,
92  const double epsilon = 1e-8,
93  const size_t maxIterations = 100000,
94  const double tolerance = 1e-5,
95  const bool shuffle = true);
96 
107  template<typename DecomposableFunctionType>
108  double Optimize(DecomposableFunctionType& function, arma::mat& iterate)
109  {
110  return optimizer.Optimize(function, iterate);
111  }
112 
114  double StepSize() const { return optimizer.StepSize(); }
116  double& StepSize() { return optimizer.StepSize(); }
117 
119  size_t BatchSize() const { return optimizer.BatchSize(); }
121  size_t& BatchSize() { return optimizer.BatchSize(); }
122 
124  double Alpha() const { return optimizer.UpdatePolicy().Alpha(); }
126  double& Alpha() { return optimizer.UpdatePolicy().Alpha(); }
127 
129  double Epsilon() const { return optimizer.UpdatePolicy().Epsilon(); }
131  double& Epsilon() { return optimizer.UpdatePolicy().Epsilon(); }
132 
134  size_t MaxIterations() const { return optimizer.MaxIterations(); }
136  size_t& MaxIterations() { return optimizer.MaxIterations(); }
137 
139  double Tolerance() const { return optimizer.Tolerance(); }
141  double& Tolerance() { return optimizer.Tolerance(); }
142 
144  bool Shuffle() const { return optimizer.Shuffle(); }
146  bool& Shuffle() { return optimizer.Shuffle(); }
147 
148  private:
150  SGD<RMSPropUpdate> optimizer;
151 };
152 
153 } // namespace optimization
154 } // namespace mlpack
155 
156 #endif
RMSProp(const double stepSize=0.01, const size_t batchSize=32, const double alpha=0.99, const double epsilon=1e-8, const size_t maxIterations=100000, const double tolerance=1e-5, const bool shuffle=true)
Construct the RMSProp optimizer with the given function and parameters.
double Tolerance() const
Get the tolerance for termination.
Definition: rmsprop.hpp:139
.hpp
Definition: add_to_po.hpp:21
size_t MaxIterations() const
Get the maximum number of iterations (0 indicates no limit).
Definition: rmsprop.hpp:134
double StepSize() const
Get the step size.
Definition: rmsprop.hpp:114
The core includes that mlpack expects; standard C++ includes and Armadillo.
double & Alpha()
Modify the smoothing parameter.
Definition: rmsprop.hpp:126
double Epsilon() const
Get the value used to initialise the mean squared gradient parameter.
Definition: rmsprop.hpp:129
size_t BatchSize() const
Get the batch size.
Definition: rmsprop.hpp:119
size_t & MaxIterations()
Modify the maximum number of iterations (0 indicates no limit).
Definition: rmsprop.hpp:136
double & Tolerance()
Modify the tolerance for termination.
Definition: rmsprop.hpp:141
double Optimize(DecomposableFunctionType &function, arma::mat &iterate)
Optimize the given function using RMSProp.
Definition: rmsprop.hpp:108
bool Shuffle() const
Get whether or not the individual functions are shuffled.
Definition: rmsprop.hpp:144
bool & Shuffle()
Modify whether or not the individual functions are shuffled.
Definition: rmsprop.hpp:146
see subsection cli_alt_reg_tut Alternate DET regularization The usual regularized error f $R_ alpha(t)\f$ of a node \f $t\f$ is given by
Definition: det.txt:344
Stochastic Gradient Descent is a technique for minimizing a function which can be expressed as a sum ...
Definition: sgd.hpp:86
double & Epsilon()
Modify the value used to initialise the mean squared gradient parameter.
Definition: rmsprop.hpp:131
RMSProp is an optimizer that utilizes the magnitude of recent gradients to normalize the gradients...
Definition: rmsprop.hpp:67
double Alpha() const
Get the smoothing parameter.
Definition: rmsprop.hpp:124
double & StepSize()
Modify the step size.
Definition: rmsprop.hpp:116
size_t & BatchSize()
Modify the batch size.
Definition: rmsprop.hpp:121