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>
108 double Optimize(arma::mat& iterate);
111 const DecomposableFunctionType&
Function()
const {
return function; }
113 DecomposableFunctionType&
Function() {
return function; }
142 DecomposableFunctionType&
function;
165 #include "minibatch_sgd_impl.hpp" size_t batchSize
The size of each mini-batch.
bool & Shuffle()
Modify whether or not the individual functions are shuffled.
Linear algebra utility functions, generally performed on matrices or vectors.
double & Tolerance()
Modify the tolerance for termination.
const DecomposableFunctionType & Function() const
Get the instantiated function to be optimized.
The core includes that mlpack expects; standard C++ includes and Armadillo.
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.
Mini-batch Stochastic Gradient Descent is a technique for minimizing a function which can be expresse...
size_t MaxIterations() const
Get the maximum number of iterations (0 indicates no limit).
double Tolerance() const
Get the tolerance for termination.
size_t & MaxIterations()
Modify the maximum number of iterations (0 indicates no limit).
DecomposableFunctionType & Function()
Modify the instantiated function.
double tolerance
The tolerance for termination.
double stepSize
The step size for each example.
double & StepSize()
Modify the step size.
double Optimize(arma::mat &iterate)
Optimize the given function using mini-batch SGD.
bool shuffle
Controls whether or not the individual functions are shuffled when iterating.
size_t & BatchSize()
Modify the batch size.
size_t BatchSize() const
Get the batch size.
double StepSize() const
Get the step size.
size_t maxIterations
The maximum number of allowed iterations.
bool Shuffle() const
Get whether or not the individual functions are shuffled.