12 #ifndef MLPACK_CORE_OPTIMIZERS_MINIBATCH_SGD_MINIBATCH_SGD_HPP
13 #define MLPACK_CORE_OPTIMIZERS_MINIBATCH_SGD_MINIBATCH_SGD_HPP
18 namespace optimization {
73 template<
typename DecomposableFunctionType>
94 const size_t batchSize = 1000,
95 const double stepSize = 0.01,
96 const size_t maxIterations = 100000,
97 const double tolerance = 1e-5,
98 const bool shuffle =
true);
108 double Optimize(arma::mat& iterate);
111 const DecomposableFunctionType&
Function()
const {
return function; }
113 DecomposableFunctionType&
Function() {
return function; }
142 DecomposableFunctionType&
function;
151 size_t maxIterations;
165 #include "minibatch_sgd_impl.hpp"
double Tolerance() const
Get the tolerance for termination.
The core includes that mlpack expects; standard C++ includes and Armadillo.
Mini-batch Stochastic Gradient Descent is a technique for minimizing a function which can be expresse...
DecomposableFunctionType & Function()
Modify the instantiated function.
double Optimize(arma::mat &iterate)
Optimize the given function using mini-batch SGD.
size_t & BatchSize()
Modify the batch size.
size_t MaxIterations() const
Get the maximum number of iterations (0 indicates no limit).
double & StepSize()
Modify the step size.
size_t BatchSize() const
Get the batch size.
MiniBatchSGD(DecomposableFunctionType &function, const size_t batchSize=1000, const double stepSize=0.01, const size_t maxIterations=100000, const double tolerance=1e-5, const bool shuffle=true)
Construct the MiniBatchSGD optimizer with the given function and parameters.
bool Shuffle() const
Get whether or not the individual functions are shuffled.
const DecomposableFunctionType & Function() const
Get the instantiated function to be optimized.
double StepSize() const
Get the step size.
double & Tolerance()
Modify the tolerance for termination.
bool & Shuffle()
Modify whether or not the individual functions are shuffled.
size_t & MaxIterations()
Modify the maximum number of iterations (0 indicates no limit).