12 #ifndef MLPACK_CORE_OPTIMIZERS_SVRG_SVRG_HPP 13 #define MLPACK_CORE_OPTIMIZERS_SVRG_SVRG_HPP 22 namespace optimization {
99 template<
typename UpdatePolicyType = SVRGUpdate,
100 typename DecayPolicyType = NoDecay>
128 SVRGType(
const double stepSize = 0.01,
129 const size_t batchSize = 32,
130 const size_t maxIterations = 1000,
131 const size_t innerIterations = 0,
132 const double tolerance = 1e-5,
133 const bool shuffle =
true,
134 const UpdatePolicyType& updatePolicy = UpdatePolicyType(),
135 const DecayPolicyType& decayPolicy = DecayPolicyType(),
136 const bool resetPolicy =
true);
148 template<
typename DecomposableFunctionType>
149 double Optimize(DecomposableFunctionType&
function, arma::mat& iterate);
194 const DecayPolicyType&
DecayPolicy()
const {
return decayPolicy; }
206 size_t maxIterations;
209 size_t innerIterations;
219 UpdatePolicyType updatePolicy;
222 DecayPolicyType decayPolicy;
245 #include "svrg_impl.hpp" double & Tolerance()
Modify the tolerance for termination.
double & StepSize()
Modify the step size.
The core includes that mlpack expects; standard C++ includes and Armadillo.
size_t & BatchSize()
Modify the batch size.
bool ResetPolicy() const
Get whether or not the update policy parameters are reset before Optimize call.
bool & ResetPolicy()
Modify whether or not the update policy parameters are reset before Optimize call.
DecayPolicyType & DecayPolicy()
Modify the step size decay policy.
double Tolerance() const
Get the tolerance for termination.
bool & Shuffle()
Modify whether or not the individual functions are shuffled.
double Optimize(DecomposableFunctionType &function, arma::mat &iterate)
Optimize the given function using SVRG.
size_t MaxIterations() const
Get the maximum number of iterations (0 indicates no limit).
SVRGType(const double stepSize=0.01, const size_t batchSize=32, const size_t maxIterations=1000, const size_t innerIterations=0, const double tolerance=1e-5, const bool shuffle=true, const UpdatePolicyType &updatePolicy=UpdatePolicyType(), const DecayPolicyType &decayPolicy=DecayPolicyType(), const bool resetPolicy=true)
Construct the SVRG optimizer with the given function and parameters.
size_t BatchSize() const
Get the batch size.
bool Shuffle() const
Get whether or not the individual functions are shuffled.
size_t InnerIterations() const
Get the maximum number of iterations (0 indicates default n / b).
size_t & MaxIterations()
Modify the maximum number of iterations (0 indicates no limit).
double StepSize() const
Get the step size.
Stochastic Variance Reduced Gradient is a technique for minimizing a function which can be expressed ...
const UpdatePolicyType & UpdatePolicy() const
Get the update policy.
UpdatePolicyType & UpdatePolicy()
Modify the update policy.
const DecayPolicyType & DecayPolicy() const
Get the step size decay policy.
size_t & InnerIterations()
Modify the maximum number of iterations (0 indicates default n / b).