LDA++
Public Types | Public Member Functions | List of all members
ldaplusplus::optimization::GradientDescent< ProblemType, ParameterType > Class Template Reference

#include <GradientDescent.hpp>

Public Types

typedef ParameterType::Scalar Scalar
 

Public Member Functions

 GradientDescent (std::shared_ptr< LineSearch< ProblemType, ParameterType > > line_search, std::function< bool(Scalar, Scalar, size_t)> progress)
 
void minimize (const ProblemType &problem, Eigen::Ref< ParameterType > x0)
 

Detailed Description

template<typename ProblemType, typename ParameterType>
class ldaplusplus::optimization::GradientDescent< ProblemType, ParameterType >

A very simple implementation of batch gradient descent.

Given a problem, a line search and a starting point it performs the following simple iteration.

  1. Repeat the following until convergence
  2. Compute the gradient
  3. Search in the direction of the gradient for sufficient decrease

Convergence is decided by another part of the program through injection of a callback.

TODO: Maybe bind the problem type through an interface

Constructor & Destructor Documentation

template<typename ProblemType , typename ParameterType >
ldaplusplus::optimization::GradientDescent< ProblemType, ParameterType >::GradientDescent ( std::shared_ptr< LineSearch< ProblemType, ParameterType > >  line_search,
std::function< bool(Scalar, Scalar, size_t)>  progress 
)
inline
Parameters
line_searchA line search method
progressA callback that decides when the optimization has ended; it can also be used to get informed about the progress of the optimization

Member Function Documentation

template<typename ProblemType , typename ParameterType >
void ldaplusplus::optimization::GradientDescent< ProblemType, ParameterType >::minimize ( const ProblemType &  problem,
Eigen::Ref< ParameterType >  x0 
)
inline

Minimize the function defined in the 'problem' argument.

The 'problem' argument should implement the functions value() and gradient() in order to be used with the GradientDescent class.

Parameters
problemThe function being minimized
x0The initial position during our minimization (it will be overwritten with the optimal position)

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