mlpack  2.2.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | List of all members
RMSprop< DecomposableFunctionType > Class Template Reference

RMSprop is an optimizer that utilizes the magnitude of recent gradients to normalize the gradients. More...

Public Member Functions

 RMSprop (DecomposableFunctionType &function, const double stepSize=0.01, const double alpha=0.99, const double eps=1e-8, const size_t maxIterations=100000, const double tolerance=1e-5, const bool shuffle=true)
 Construct the RMSprop optimizer with the given function and parameters. More...
 
double Alpha () const
 Get the smoothing parameter. More...
 
double & Alpha ()
 Modify the smoothing parameter. 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 RMSprop. 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...
 

Detailed Description

template<typename DecomposableFunctionType>
class mlpack::optimization::RMSprop< DecomposableFunctionType >

RMSprop is an optimizer that utilizes the magnitude of recent gradients to normalize the gradients.

In its basic form, given a step rate $ \gamma $ and a decay term $ \alpha $ we perform the following updates:

\begin{eqnarray*} r_t &=& (1 - \gamma) f'(\Delta_t)^2 + \gamma r_{t - 1} \\ v_{t + 1} &=& \frac{\alpha}{\sqrt{r_t}}f'(\Delta_t) \\ \Delta_{t + 1} &=& \Delta_t - v_{t + 1} \end{eqnarray*}

For more information, see the following.

* @misc{tieleman2012,
* title={Lecture 6.5 - rmsprop, COURSERA: Neural Networks for Machine
* Learning},
* year={2012}
* }
*

For RMSprop 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 ( $n$), 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
DecomposableFunctionTypeDecomposable objective function type to be minimized.

Definition at line 64 of file rmsprop.hpp.

Constructor & Destructor Documentation

RMSprop ( DecomposableFunctionType &  function,
const double  stepSize = 0.01,
const double  alpha = 0.99,
const double  eps = 1e-8,
const size_t  maxIterations = 100000,
const double  tolerance = 1e-5,
const bool  shuffle = true 
)

Construct the RMSprop 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).

Parameters
functionFunction to be optimized (minimized).
stepSizeStep size for each iteration.
alphaSmoothing constant, similar to that used in AdaDelta and momentum methods.
epsValue used to initialise the mean squared gradient parameter.
maxIterationsMaximum number of iterations allowed (0 means no limit).
toleranceMaximum absolute tolerance to terminate algorithm.
shuffleIf true, the function order is shuffled; otherwise, each function is visited in linear order.

Member Function Documentation

double Alpha ( ) const
inline

Get the smoothing parameter.

Definition at line 115 of file rmsprop.hpp.

double& Alpha ( )
inline

Modify the smoothing parameter.

Definition at line 117 of file rmsprop.hpp.

double Epsilon ( ) const
inline

Get the value used to initialise the mean squared gradient parameter.

Definition at line 120 of file rmsprop.hpp.

double& Epsilon ( )
inline

Modify the value used to initialise the mean squared gradient parameter.

Definition at line 122 of file rmsprop.hpp.

const DecomposableFunctionType& Function ( ) const
inline

Get the instantiated function to be optimized.

Definition at line 105 of file rmsprop.hpp.

DecomposableFunctionType& Function ( )
inline

Modify the instantiated function.

Definition at line 107 of file rmsprop.hpp.

size_t MaxIterations ( ) const
inline

Get the maximum number of iterations (0 indicates no limit).

Definition at line 125 of file rmsprop.hpp.

size_t& MaxIterations ( )
inline

Modify the maximum number of iterations (0 indicates no limit).

Definition at line 127 of file rmsprop.hpp.

double Optimize ( arma::mat &  iterate)

Optimize the given function using RMSprop.

The given starting point will be modified to store the finishing point of the algorithm, and the final objective value is returned.

Parameters
iterateStarting point (will be modified).
Returns
Objective value of the final point.
bool Shuffle ( ) const
inline

Get whether or not the individual functions are shuffled.

Definition at line 135 of file rmsprop.hpp.

bool& Shuffle ( )
inline

Modify whether or not the individual functions are shuffled.

Definition at line 137 of file rmsprop.hpp.

double StepSize ( ) const
inline

Get the step size.

Definition at line 110 of file rmsprop.hpp.

double& StepSize ( )
inline

Modify the step size.

Definition at line 112 of file rmsprop.hpp.

double Tolerance ( ) const
inline

Get the tolerance for termination.

Definition at line 130 of file rmsprop.hpp.

double& Tolerance ( )
inline

Modify the tolerance for termination.

Definition at line 132 of file rmsprop.hpp.


The documentation for this class was generated from the following file: