SMORMS3 is an optimizer that estimates a safe and optimal distance based on curvature and normalizing the stepsize in the parameter space. More...
Public Member Functions | |
| SMORMS3 (const double stepSize=0.001, const size_t batchSize=32, const double epsilon=1e-16, const size_t maxIterations=100000, const double tolerance=1e-5, const bool shuffle=true) | |
| Construct the SMORMS3 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... | |
| double | Epsilon () const |
| Get the value used to initialise the mean squared gradient parameter. More... | |
| double & | Epsilon () |
| Modify the value used to initialise the mean squared gradient parameter. 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 SMORMS3. 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... | |
SMORMS3 is an optimizer that estimates a safe and optimal distance based on curvature and normalizing the stepsize in the parameter space.
It is a hybrid of RMSprop and Yann LeCun’s method in "No more pesky learning rates".
For more information, see the following.
For SMORMS3 to work, a DecomposableFunctionType template parameter is required. This class must implement the following function:
size_t NumFunctions(); double Evaluate(const arma::mat& coordinates, const size_t i, const size_t batchSize); void Gradient(const arma::mat& coordinates, const size_t i, arma::mat& gradient, const size_t batchSize);
NumFunctions() should return the number of functions (
), and in the other two functions, the parameter i refers to which individual function (or gradient) is being evaluated. So, for the case of a data-dependent function, such as NCA (see mlpack::nca::NCA), NumFunctions() should return the number of points in the dataset, and Evaluate(coordinates, 0) will evaluate the objective function on the first point in the dataset (presumably, the dataset is held internally in the DecomposableFunctionType).
Definition at line 62 of file smorms3.hpp.
| SMORMS3 | ( | const double | stepSize = 0.001, |
| const size_t | batchSize = 32, |
||
| const double | epsilon = 1e-16, |
||
| const size_t | maxIterations = 100000, |
||
| const double | tolerance = 1e-5, |
||
| const bool | shuffle = true |
||
| ) |
Construct the SMORMS3 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 to the task at hand. The maximum number of iterations refers to the maximum number of points that are processed (i.e., one iteration equals one point; one iteration does not equal one pass over the dataset).
| stepSize | Step size for each iteration. |
| batchSize | Number of points to process at each step. |
| epsilon | Value used to initialise the mean squared gradient parameter. |
| maxIterations | Maximum number of iterations allowed (0 means no limit). |
| tolerance | Maximum absolute tolerance to terminate algorithm. |
| shuffle | If true, the function order is shuffled; otherwise, each function is visited in linear order. |
|
inline |
Get the batch size.
Definition at line 112 of file smorms3.hpp.
|
inline |
Modify the batch size.
Definition at line 114 of file smorms3.hpp.
|
inline |
Get the value used to initialise the mean squared gradient parameter.
Definition at line 117 of file smorms3.hpp.
|
inline |
Modify the value used to initialise the mean squared gradient parameter.
Definition at line 119 of file smorms3.hpp.
|
inline |
Get the maximum number of iterations (0 indicates no limit).
Definition at line 122 of file smorms3.hpp.
|
inline |
Modify the maximum number of iterations (0 indicates no limit).
Definition at line 124 of file smorms3.hpp.
|
inline |
Optimize the given function using SMORMS3.
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 optimize. |
| iterate | Starting point (will be modified). |
Definition at line 101 of file smorms3.hpp.
|
inline |
Get whether or not the individual functions are shuffled.
Definition at line 132 of file smorms3.hpp.
|
inline |
Modify whether or not the individual functions are shuffled.
Definition at line 134 of file smorms3.hpp.
|
inline |
Get the step size.
Definition at line 107 of file smorms3.hpp.
|
inline |
Modify the step size.
Definition at line 109 of file smorms3.hpp.
|
inline |
Get the tolerance for termination.
Definition at line 127 of file smorms3.hpp.
|
inline |
Modify the tolerance for termination.
Definition at line 129 of file smorms3.hpp.