smorms3.hpp
Go to the documentation of this file.
1 
14 #ifndef MLPACK_CORE_OPTIMIZERS_SMORMS3_SMORMS3_HPP
15 #define MLPACK_CORE_OPTIMIZERS_SMORMS3_SMORMS3_HPP
16 
17 #include <mlpack/prereqs.hpp>
19 
20 #include "smorms3_update.hpp"
21 
22 namespace mlpack {
23 namespace optimization {
24 
62 class SMORMS3
63 {
64  public:
83  SMORMS3(const double stepSize = 0.001,
84  const size_t batchSize = 32,
85  const double epsilon = 1e-16,
86  const size_t maxIterations = 100000,
87  const double tolerance = 1e-5,
88  const bool shuffle = true);
89 
100  template<typename DecomposableFunctionType>
101  double Optimize(DecomposableFunctionType& function, arma::mat& iterate)
102  {
103  return optimizer.Optimize(function, iterate);
104  }
105 
107  double StepSize() const { return optimizer.StepSize(); }
109  double& StepSize() { return optimizer.StepSize(); }
110 
112  size_t BatchSize() const { return optimizer.BatchSize(); }
114  size_t& BatchSize() { return optimizer.BatchSize(); }
115 
117  double Epsilon() const { return optimizer.UpdatePolicy().Epsilon(); }
119  double& Epsilon() { return optimizer.UpdatePolicy().Epsilon(); }
120 
122  size_t MaxIterations() const { return optimizer.MaxIterations(); }
124  size_t& MaxIterations() { return optimizer.MaxIterations(); }
125 
127  double Tolerance() const { return optimizer.Tolerance(); }
129  double& Tolerance() { return optimizer.Tolerance(); }
130 
132  bool Shuffle() const { return optimizer.Shuffle(); }
134  bool& Shuffle() { return optimizer.Shuffle(); }
135 
136  private:
138  SGD<SMORMS3Update> optimizer;
139 };
140 
141 } // namespace optimization
142 } // namespace mlpack
143 
144 #endif
size_t MaxIterations() const
Get the maximum number of iterations (0 indicates no limit).
Definition: smorms3.hpp:122
double StepSize() const
Get the step size.
Definition: smorms3.hpp:107
.hpp
Definition: add_to_po.hpp:21
The core includes that mlpack expects; standard C++ includes and Armadillo.
size_t BatchSize() const
Get the batch size.
Definition: smorms3.hpp:112
bool Shuffle() const
Get whether or not the individual functions are shuffled.
Definition: smorms3.hpp:132
double Epsilon() const
Get the value used to initialise the mean squared gradient parameter.
Definition: smorms3.hpp:117
size_t & BatchSize()
Modify the batch size.
Definition: smorms3.hpp:114
double & StepSize()
Modify the step size.
Definition: smorms3.hpp:109
double Tolerance() const
Get the tolerance for termination.
Definition: smorms3.hpp:127
double & Tolerance()
Modify the tolerance for termination.
Definition: smorms3.hpp:129
SMORMS3(const double stepSize=0.001, const size_t batchSize=32, const double epsilon=1e-16, const size_t maxIterations=100000, const double tolerance=1e-5, const bool shuffle=true)
Construct the SMORMS3 optimizer with the given function and parameters.
double Optimize(DecomposableFunctionType &function, arma::mat &iterate)
Optimize the given function using SMORMS3.
Definition: smorms3.hpp:101
Stochastic Gradient Descent is a technique for minimizing a function which can be expressed as a sum ...
Definition: sgd.hpp:86
size_t & MaxIterations()
Modify the maximum number of iterations (0 indicates no limit).
Definition: smorms3.hpp:124
bool & Shuffle()
Modify whether or not the individual functions are shuffled.
Definition: smorms3.hpp:134
SMORMS3 is an optimizer that estimates a safe and optimal distance based on curvature and normalizing...
Definition: smorms3.hpp:62
double & Epsilon()
Modify the value used to initialise the mean squared gradient parameter.
Definition: smorms3.hpp:119