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 using the Snapshot ensembles technique. More...
Public Types | |
| using | OptimizerType = SGD< UpdatePolicyType, SnapshotEnsembles > |
| Convenience typedef for the internal optimizer construction. More... | |
Public Member Functions | |
| SnapshotSGDR (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 size_t snapshots=5, const bool accumulate=true, const UpdatePolicyType &updatePolicy=UpdatePolicyType()) | |
| Construct the SnapshotSGDR optimizer with snapshot ensembles 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... | |
| std::vector< arma::mat > | Snapshots () const |
| Get the snapshots. More... | |
| std::vector< arma::mat > & | Snapshots () |
| Modify the snapshots. 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 using the Snapshot ensembles technique.
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. |
Definition at line 61 of file snapshot_sgdr.hpp.
| using OptimizerType = SGD<UpdatePolicyType, SnapshotEnsembles> |
Convenience typedef for the internal optimizer construction.
Definition at line 65 of file snapshot_sgdr.hpp.
| SnapshotSGDR | ( | 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 size_t | snapshots = 5, |
||
| const bool | accumulate = true, |
||
| const UpdatePolicyType & | updatePolicy = UpdatePolicyType() |
||
| ) |
Construct the SnapshotSGDR optimizer with snapshot ensembles 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. |
| snapshots | Maximum number of snapshots. |
| accumulate | Accumulate the snapshot parameter (default true). |
| updatePolicy | Instantiated update policy used to adjust the given parameters. |
|
inline |
Get the batch size.
Definition at line 111 of file snapshot_sgdr.hpp.
References SGD< UpdatePolicyType, DecayPolicyType >::BatchSize().
|
inline |
Modify the batch size.
Definition at line 113 of file snapshot_sgdr.hpp.
References SGD< UpdatePolicyType, DecayPolicyType >::BatchSize().
|
inline |
Get the maximum number of iterations (0 indicates no limit).
Definition at line 121 of file snapshot_sgdr.hpp.
References SGD< UpdatePolicyType, DecayPolicyType >::MaxIterations().
|
inline |
Modify the maximum number of iterations (0 indicates no limit).
Definition at line 123 of file snapshot_sgdr.hpp.
References SGD< UpdatePolicyType, DecayPolicyType >::MaxIterations().
| double Optimize | ( | DecomposableFunctionType & | function, |
| arma::mat & | iterate | ||
| ) |
|
inline |
Get whether or not the individual functions are shuffled.
Definition at line 131 of file snapshot_sgdr.hpp.
References SGD< UpdatePolicyType, DecayPolicyType >::Shuffle().
|
inline |
Modify whether or not the individual functions are shuffled.
Definition at line 133 of file snapshot_sgdr.hpp.
References SGD< UpdatePolicyType, DecayPolicyType >::Shuffle().
|
inline |
Get the snapshots.
Definition at line 136 of file snapshot_sgdr.hpp.
References SGD< UpdatePolicyType, DecayPolicyType >::DecayPolicy(), and SnapshotEnsembles::Snapshots().
|
inline |
Modify the snapshots.
Definition at line 141 of file snapshot_sgdr.hpp.
References SGD< UpdatePolicyType, DecayPolicyType >::DecayPolicy(), and SnapshotEnsembles::Snapshots().
|
inline |
Get the step size.
Definition at line 116 of file snapshot_sgdr.hpp.
References SGD< UpdatePolicyType, DecayPolicyType >::StepSize().
|
inline |
Modify the step size.
Definition at line 118 of file snapshot_sgdr.hpp.
References SGD< UpdatePolicyType, DecayPolicyType >::StepSize().
|
inline |
Get the tolerance for termination.
Definition at line 126 of file snapshot_sgdr.hpp.
References SGD< UpdatePolicyType, DecayPolicyType >::Tolerance().
|
inline |
Modify the tolerance for termination.
Definition at line 128 of file snapshot_sgdr.hpp.
References SGD< UpdatePolicyType, DecayPolicyType >::Tolerance().
|
inline |
Get the update policy.
Definition at line 147 of file snapshot_sgdr.hpp.
References SGD< UpdatePolicyType, DecayPolicyType >::UpdatePolicy().
|
inline |
Modify the update policy.
Definition at line 152 of file snapshot_sgdr.hpp.
References SGD< UpdatePolicyType, DecayPolicyType >::UpdatePolicy().