12 #ifndef MLPACK_CORE_OPTIMIZERS_PARALLEL_SGD_HPP 13 #define MLPACK_CORE_OPTIMIZERS_PARALLEL_SGD_HPP 20 namespace optimization {
59 template <
typename DecayPolicyType = ConstantStep>
81 const size_t threadShareSize,
82 const double tolerance = 1e-5,
83 const bool shuffle =
true,
84 const DecayPolicyType& decayPolicy = DecayPolicyType());
97 template <
typename SparseFunctionType>
98 double Optimize(SparseFunctionType&
function, arma::mat& iterate);
129 size_t maxIterations;
132 size_t threadShareSize;
142 DecayPolicyType decayPolicy;
149 #include "parallel_sgd_impl.hpp" ParallelSGD(const size_t maxIterations, const size_t threadShareSize, const double tolerance=1e-5, const bool shuffle=true, const DecayPolicyType &decayPolicy=DecayPolicyType())
Construct the parallel SGD optimizer to optimize the given function with the given parameters...
double Optimize(SparseFunctionType &function, arma::mat &iterate)
Optimize the given function using the parallel SGD algorithm.
The core includes that mlpack expects; standard C++ includes and Armadillo.
size_t & ThreadShareSize()
Modify the number of datapoints to be processed in one iteration by each thread.
double Tolerance() const
Get the tolerance for termination.
bool Shuffle() const
Get whether or not the individual functions are shuffled.
DecayPolicyType & DecayPolicy() const
Get the step size decay policy.
DecayPolicyType & DecayPolicy()
Modify the step size decay policy.
double & Tolerance()
Modify the tolerance for termination.
Miscellaneous math random-related routines.
size_t MaxIterations() const
Get the maximum number of iterations (0 indicates no limits).
size_t ThreadShareSize() const
Get the number of datapoints to be processed in one iteration by each thread.
An implementation of parallel stochastic gradient descent using the lock-free HOGWILD! approach...
bool & Shuffle()
Modify whether or not the individual functions are shuffled.
size_t & MaxIterations()
Modify the maximum number of iterations (0 indicates no limits).