mlpack  git-master
KatyushaType< Proximal > Class Template Reference

Katyusha is a direct, primal-only stochastic gradient method which uses a "negative momentum" on top of Nesterov’s momentum. More...

Public Member Functions

 KatyushaType (const double convexity=1.0, const double lipschitz=10.0, const size_t batchSize=32, const size_t maxIterations=1000, const size_t innerIterations=0, const double tolerance=1e-5, const bool shuffle=true)
 Construct the Katyusha 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 Convexity () const
 Get the convexity parameter. More...

 
double & Convexity ()
 Modify the convexity parameter. More...

 
size_t InnerIterations () const
 Get the maximum number of iterations (0 indicates default n / b). More...

 
size_t & InnerIterations ()
 Modify the maximum number of iterations (0 indicates default n / b). More...

 
double Lipschitz () const
 Get the lipschitz parameter. More...

 
double & Lipschitz ()
 Modify the lipschitz 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 Katyusha. 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 Tolerance () const
 Get the tolerance for termination. More...

 
double & Tolerance ()
 Modify the tolerance for termination. More...

 

Detailed Description


template<bool Proximal = false>
class mlpack::optimization::KatyushaType< Proximal >

Katyusha is a direct, primal-only stochastic gradient method which uses a "negative momentum" on top of Nesterov’s momentum.

For more information, see the following.

@inproceedings{Allen-Zhu2016,
author = {{Allen-Zhu}, Z.},
title = {Katyusha: The First Direct Acceleration of Stochastic Gradient
Methods},
booktitle = {Proceedings of the 49th Annual ACM SIGACT Symposium on Theory
of Computing},
pages = {1200--1205},
publisher = {ACM},
year = {2017},
series = {STOC 2017},
}

For Katyusha 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 ( $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
proximalWhether the proximal update should be used or not.

Definition at line 63 of file katyusha.hpp.

Constructor & Destructor Documentation

◆ KatyushaType()

KatyushaType ( const double  convexity = 1.0,
const double  lipschitz = 10.0,
const size_t  batchSize = 32,
const size_t  maxIterations = 1000,
const size_t  innerIterations = 0,
const double  tolerance = 1e-5,
const bool  shuffle = true 
)

Construct the Katyusha 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
convexityThe regularization parameter.
lipschitzThe Lipschitz constant.
batchSizeBatch size to use for each step.
maxIterationsMaximum number of iterations allowed (0 means no limit).
innerIterationsThe number of inner iterations allowed (0 means n / batchSize). Note that the full gradient is only calculated in the outer iteration.
toleranceMaximum absolute tolerance to terminate algorithm.
shuffleIf true, the function order is shuffled; otherwise, each function is visited in linear order.

Member Function Documentation

◆ BatchSize() [1/2]

size_t BatchSize ( ) const
inline

Get the batch size.

Definition at line 118 of file katyusha.hpp.

◆ BatchSize() [2/2]

size_t& BatchSize ( )
inline

Modify the batch size.

Definition at line 120 of file katyusha.hpp.

◆ Convexity() [1/2]

double Convexity ( ) const
inline

Get the convexity parameter.

Definition at line 108 of file katyusha.hpp.

◆ Convexity() [2/2]

double& Convexity ( )
inline

Modify the convexity parameter.

Definition at line 110 of file katyusha.hpp.

◆ InnerIterations() [1/2]

size_t InnerIterations ( ) const
inline

Get the maximum number of iterations (0 indicates default n / b).

Definition at line 128 of file katyusha.hpp.

◆ InnerIterations() [2/2]

size_t& InnerIterations ( )
inline

Modify the maximum number of iterations (0 indicates default n / b).

Definition at line 130 of file katyusha.hpp.

◆ Lipschitz() [1/2]

double Lipschitz ( ) const
inline

Get the lipschitz parameter.

Definition at line 113 of file katyusha.hpp.

◆ Lipschitz() [2/2]

double& Lipschitz ( )
inline

Modify the lipschitz parameter.

Definition at line 115 of file katyusha.hpp.

◆ MaxIterations() [1/2]

size_t MaxIterations ( ) const
inline

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

Definition at line 123 of file katyusha.hpp.

◆ MaxIterations() [2/2]

size_t& MaxIterations ( )
inline

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

Definition at line 125 of file katyusha.hpp.

◆ Optimize()

double Optimize ( DecomposableFunctionType &  function,
arma::mat &  iterate 
)

Optimize the given function using Katyusha.

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

Template Parameters
DecomposableFunctionTypeType of the function to be optimized.
Parameters
functionFunction to optimize.
iterateStarting point (will be modified).
Returns
Objective value of the final point.

◆ Shuffle() [1/2]

bool Shuffle ( ) const
inline

Get whether or not the individual functions are shuffled.

Definition at line 138 of file katyusha.hpp.

◆ Shuffle() [2/2]

bool& Shuffle ( )
inline

Modify whether or not the individual functions are shuffled.

Definition at line 140 of file katyusha.hpp.

◆ Tolerance() [1/2]

double Tolerance ( ) const
inline

Get the tolerance for termination.

Definition at line 133 of file katyusha.hpp.

◆ Tolerance() [2/2]

double& Tolerance ( )
inline

Modify the tolerance for termination.

Definition at line 135 of file katyusha.hpp.


The documentation for this class was generated from the following file:
  • /var/www/www.mlpack.org/mlpack-git/src/mlpack/core/optimizers/katyusha/katyusha.hpp