mlpack  git-master
katyusha.hpp
Go to the documentation of this file.
1 
12 #ifndef MLPACK_CORE_OPTIMIZERS_KATYUSHA_KATYUSHA_HPP
13 #define MLPACK_CORE_OPTIMIZERS_KATYUSHA_KATYUSHA_HPP
14 
15 #include <mlpack/prereqs.hpp>
16 
17 namespace mlpack {
18 namespace optimization {
19 
62 template<bool Proximal = false>
64 {
65  public:
86  KatyushaType(const double convexity = 1.0,
87  const double lipschitz = 10.0,
88  const size_t batchSize = 32,
89  const size_t maxIterations = 1000,
90  const size_t innerIterations = 0,
91  const double tolerance = 1e-5,
92  const bool shuffle = true);
93 
104  template<typename DecomposableFunctionType>
105  double Optimize(DecomposableFunctionType& function, arma::mat& iterate);
106 
108  double Convexity() const { return convexity; }
110  double& Convexity() { return convexity; }
111 
113  double Lipschitz() const { return lipschitz; }
115  double& Lipschitz() { return lipschitz; }
116 
118  size_t BatchSize() const { return batchSize; }
120  size_t& BatchSize() { return batchSize; }
121 
123  size_t MaxIterations() const { return maxIterations; }
125  size_t& MaxIterations() { return maxIterations; }
126 
128  size_t InnerIterations() const { return innerIterations; }
130  size_t& InnerIterations() { return innerIterations; }
131 
133  double Tolerance() const { return tolerance; }
135  double& Tolerance() { return tolerance; }
136 
138  bool Shuffle() const { return shuffle; }
140  bool& Shuffle() { return shuffle; }
141 
142  private:
144  double convexity;
145 
147  double lipschitz;
148 
150  size_t batchSize;
151 
153  size_t maxIterations;
154 
156  size_t innerIterations;
157 
159  double tolerance;
160 
163  bool shuffle;
164 };
165 
166 // Convenience typedefs.
167 
172 
177 
178 } // namespace optimization
179 } // namespace mlpack
180 
181 // Include implementation.
182 #include "katyusha_impl.hpp"
183 
184 #endif
size_t MaxIterations() const
Get the maximum number of iterations (0 indicates no limit).
Definition: katyusha.hpp:123
.hpp
Definition: add_to_po.hpp:21
The core includes that mlpack expects; standard C++ includes and Armadillo.
double Convexity() const
Get the convexity parameter.
Definition: katyusha.hpp:108
double Optimize(DecomposableFunctionType &function, arma::mat &iterate)
Optimize the given function using Katyusha.
double & Lipschitz()
Modify the lipschitz parameter.
Definition: katyusha.hpp:115
bool Shuffle() const
Get whether or not the individual functions are shuffled.
Definition: katyusha.hpp:138
size_t & InnerIterations()
Modify the maximum number of iterations (0 indicates default n / b).
Definition: katyusha.hpp:130
size_t & BatchSize()
Modify the batch size.
Definition: katyusha.hpp:120
KatyushaType(const double convexity=1.0, const double lipschitz=10.0, const size_t batchSize=32, const size_t maxIterations=1000, const size_t innerIterations=0, const double tolerance=1e-5, const bool shuffle=true)
Construct the Katyusha optimizer with the given function and parameters.
bool & Shuffle()
Modify whether or not the individual functions are shuffled.
Definition: katyusha.hpp:140
size_t InnerIterations() const
Get the maximum number of iterations (0 indicates default n / b).
Definition: katyusha.hpp:128
Katyusha is a direct, primal-only stochastic gradient method which uses a "negative momentum" on top ...
Definition: katyusha.hpp:63
size_t BatchSize() const
Get the batch size.
Definition: katyusha.hpp:118
size_t & MaxIterations()
Modify the maximum number of iterations (0 indicates no limit).
Definition: katyusha.hpp:125
double Lipschitz() const
Get the lipschitz parameter.
Definition: katyusha.hpp:113
double & Tolerance()
Modify the tolerance for termination.
Definition: katyusha.hpp:135
double Tolerance() const
Get the tolerance for termination.
Definition: katyusha.hpp:133
double & Convexity()
Modify the convexity parameter.
Definition: katyusha.hpp:110