This class is based on Mini-batch Stochastic Gradient Descent class and simulates a new warm-started run/restart once a number of epochs are performed. More...
Public Types | |
| using | OptimizerType = SGD< UpdatePolicyType, CyclicalDecay > |
| Convenience typedef for the internal optimizer construction. More... | |
Public Member Functions | |
| SGDR (const size_t epochRestart=50, const double multFactor=2.0, const size_t batchSize=1000, const double stepSize=0.01, const size_t maxIterations=100000, const double tolerance=1e-5, const bool shuffle=true, const UpdatePolicyType &updatePolicy=UpdatePolicyType()) | |
| Construct the SGDR optimizer with the given function and parameters. More... | |
| size_t | BatchSize () const |
| Get the batch size. More... | |
| size_t & | BatchSize () |
| Modify the batch size. More... | |
| size_t | MaxIterations () const |
| Get the maximum number of iterations (0 indicates no limit). More... | |
| size_t & | MaxIterations () |
| Modify the maximum number of iterations (0 indicates no limit). More... | |
template < typename DecomposableFunctionType > | |
| double | Optimize (DecomposableFunctionType &function, arma::mat &iterate) |
| Optimize the given function using SGDR. More... | |
| bool | Shuffle () const |
| Get whether or not the individual functions are shuffled. More... | |
| bool & | Shuffle () |
| Modify whether or not the individual functions are shuffled. More... | |
| double | StepSize () const |
| Get the step size. More... | |
| double & | StepSize () |
| Modify the step size. More... | |
| double | Tolerance () const |
| Get the tolerance for termination. More... | |
| double & | Tolerance () |
| Modify the tolerance for termination. More... | |
| const UpdatePolicyType & | UpdatePolicy () const |
| Get the update policy. More... | |
| UpdatePolicyType & | UpdatePolicy () |
| Modify the update policy. More... | |
This class is based on Mini-batch Stochastic Gradient Descent class and simulates a new warm-started run/restart once a number of epochs are performed.
For more information, please refer to:
| UpdatePolicyType | Update policy used during the iterative update process. By default the momentum update policy (see mlpack::optimization::MomentumUpdate) is used. |
| using OptimizerType = SGD<UpdatePolicyType, CyclicalDecay> |
| SGDR | ( | const size_t | epochRestart = 50, |
| const double | multFactor = 2.0, |
||
| const size_t | batchSize = 1000, |
||
| const double | stepSize = 0.01, |
||
| const size_t | maxIterations = 100000, |
||
| const double | tolerance = 1e-5, |
||
| const bool | shuffle = true, |
||
| const UpdatePolicyType & | updatePolicy = UpdatePolicyType() |
||
| ) |
Construct the SGDR optimizer with the given function and parameters.
The defaults here are not necessarily good for the given problem, so it is suggested that the values used be tailored for the task at hand. The maximum number of iterations refers to the maximum number of mini-batches that are processed.
| epochRestart | Initial epoch where decay is applied. |
| batchSize | Size of each mini-batch. |
| stepSize | Step size for each iteration. |
| maxIterations | Maximum number of iterations allowed (0 means no limit). |
| tolerance | Maximum absolute tolerance to terminate algorithm. |
| shuffle | If true, the mini-batch order is shuffled; otherwise, each mini-batch is visited in linear order. |
| updatePolicy | Instantiated update policy used to adjust the given parameters. |
|
inline |
Get the batch size.
Definition at line 95 of file sgdr.hpp.
References SGD< UpdatePolicyType, DecayPolicyType >::BatchSize().
|
inline |
Modify the batch size.
Definition at line 97 of file sgdr.hpp.
References SGD< UpdatePolicyType, DecayPolicyType >::BatchSize().
|
inline |
Get the maximum number of iterations (0 indicates no limit).
Definition at line 105 of file sgdr.hpp.
References SGD< UpdatePolicyType, DecayPolicyType >::MaxIterations().
|
inline |
Modify the maximum number of iterations (0 indicates no limit).
Definition at line 107 of file sgdr.hpp.
References SGD< UpdatePolicyType, DecayPolicyType >::MaxIterations().
| double Optimize | ( | DecomposableFunctionType & | function, |
| arma::mat & | iterate | ||
| ) |
Optimize the given function using SGDR.
The given starting point will be modified to store the finishing point of the algorithm, and the final objective value is returned.
| DecomposableFunctionType | Type of the function to be optimized. |
| function | Function to be optimized. |
| iterate | Starting point (will be modified). |
|
inline |
Get whether or not the individual functions are shuffled.
Definition at line 115 of file sgdr.hpp.
References SGD< UpdatePolicyType, DecayPolicyType >::Shuffle().
|
inline |
Modify whether or not the individual functions are shuffled.
Definition at line 117 of file sgdr.hpp.
References SGD< UpdatePolicyType, DecayPolicyType >::Shuffle().
|
inline |
Get the step size.
Definition at line 100 of file sgdr.hpp.
References SGD< UpdatePolicyType, DecayPolicyType >::StepSize().
|
inline |
Modify the step size.
Definition at line 102 of file sgdr.hpp.
References SGD< UpdatePolicyType, DecayPolicyType >::StepSize().
|
inline |
Get the tolerance for termination.
Definition at line 110 of file sgdr.hpp.
References SGD< UpdatePolicyType, DecayPolicyType >::Tolerance().
|
inline |
Modify the tolerance for termination.
Definition at line 112 of file sgdr.hpp.
References SGD< UpdatePolicyType, DecayPolicyType >::Tolerance().
|
inline |
Get the update policy.
Definition at line 120 of file sgdr.hpp.
References SGD< UpdatePolicyType, DecayPolicyType >::UpdatePolicy().
|
inline |
Modify the update policy.
Definition at line 125 of file sgdr.hpp.
References SGD< UpdatePolicyType, DecayPolicyType >::UpdatePolicy().