iqn.hpp
Go to the documentation of this file.
1 
14 #ifndef MLPACK_CORE_OPTIMIZERS_IQN_IQN_HPP
15 #define MLPACK_CORE_OPTIMIZERS_IQN_IQN_HPP
16 
17 #include <mlpack/prereqs.hpp>
18 
19 namespace mlpack {
20 namespace optimization {
21 
65 class IQN
66 {
67  public:
82  IQN(const double stepSize = 0.01,
83  const size_t batchSize = 10,
84  const size_t maxIterations = 100000,
85  const double tolerance = 1e-5);
86 
97  template<typename DecomposableFunctionType>
98  double Optimize(DecomposableFunctionType& function, arma::mat& iterate);
99 
101  double StepSize() const { return stepSize; }
103  double& StepSize() { return stepSize; }
104 
106  size_t BatchSize() const { return batchSize; }
108  size_t& BatchSize() { return batchSize; }
109 
111  size_t MaxIterations() const { return maxIterations; }
113  size_t& MaxIterations() { return maxIterations; }
114 
116  double Tolerance() const { return tolerance; }
118  double& Tolerance() { return tolerance; }
119 
120  private:
122  double stepSize;
123 
125  size_t batchSize;
126 
128  size_t maxIterations;
129 
131  double tolerance;
132 };
133 
134 } // namespace optimization
135 } // namespace mlpack
136 
137 // Include implementation.
138 #include "iqn_impl.hpp"
139 
140 #endif
double & Tolerance()
Modify the tolerance for termination.
Definition: iqn.hpp:118
size_t MaxIterations() const
Get the maximum number of iterations (0 indicates no limit).
Definition: iqn.hpp:111
size_t & BatchSize()
Modify the batch size.
Definition: iqn.hpp:108
.hpp
Definition: add_to_po.hpp:21
The core includes that mlpack expects; standard C++ includes and Armadillo.
double Optimize(DecomposableFunctionType &function, arma::mat &iterate)
Optimize the given function using IQN.
size_t BatchSize() const
Get the batch size.
Definition: iqn.hpp:106
IQN is a technique for minimizing a function which can be expressed as a sum of other functions...
Definition: iqn.hpp:65
size_t & MaxIterations()
Modify the maximum number of iterations (0 indicates no limit).
Definition: iqn.hpp:113
double StepSize() const
Get the step size.
Definition: iqn.hpp:101
IQN(const double stepSize=0.01, const size_t batchSize=10, const size_t maxIterations=100000, const double tolerance=1e-5)
Construct the IQN optimizer with the given function and parameters.
double Tolerance() const
Get the tolerance for termination.
Definition: iqn.hpp:116
double & StepSize()
Modify the step size.
Definition: iqn.hpp:103