|
| Adam (DecomposableFunctionType &function, const double stepSize=0.001, const double beta1=0.9, const double beta2=0.999, const double eps=1e-8, const size_t maxIterations=100000, const double tolerance=1e-5, const bool shuffle=true) |
| Construct the Adam optimizer with the given function and parameters. More...
|
|
double | Beta1 () const |
| Get the smoothing parameter. More...
|
|
double & | Beta1 () |
| Modify the smoothing parameter. More...
|
|
double | Beta2 () const |
| Get the second moment coefficient. More...
|
|
double & | Beta2 () |
| Modify the second moment coefficient. 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...
|
|
const DecomposableFunctionType & | Function () const |
| Get the instantiated function to be optimized. More...
|
|
DecomposableFunctionType & | Function () |
| Modify the instantiated function. 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...
|
|
double | Optimize (arma::mat &iterate) |
| Optimize the given function using Adam. 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...
|
|
template<typename DecomposableFunctionType>
class mlpack::optimization::Adam< DecomposableFunctionType >
Adam is an optimizer that computes individual adaptive learning rates for different parameters from estimates of first and second moments of the gradients.
For more information, see the following.
* @article{Kingma2014,
* author = {Diederik P. Kingma and Jimmy Ba},
* title = {
Adam: {A} Method
for Stochastic Optimization},
* journal = {CoRR},
* year = {2014}
* }
*
For Adam 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); void Gradient(const arma::mat& coordinates, const size_t i, arma::mat& gradient);
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).
- Template Parameters
-
DecomposableFunctionType | Decomposable objective function type to be minimized. |
Definition at line 62 of file adam.hpp.