NeuralEngine A Game Engine with embeded Machine Learning algorithms based on Gaussian Processes. |

Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
NeuralEngine::MachineLearning::BaseGradientOptimizationMethod< Scalar, LSType > Class Template Reference

Base class for gradient-based optimization methods. More...

`#include <BaseGradientOptimizationMethod.h>`

Inheritance diagram for NeuralEngine::MachineLearning::BaseGradientOptimizationMethod< Scalar, LSType >:
[legend]
Collaboration diagram for NeuralEngine::MachineLearning::BaseGradientOptimizationMethod< Scalar, LSType >:
[legend]

## Public Member Functions
Scalar | GetTolerance ()
| Gets the relative difference threshold to be used as stopping criteria between two iterations. Default is 0 (iterate until convergence). More...
void | SetTolerance (Scalar tolerance)
| Sets the relative difference threshold to be used as stopping criteria between two iterations. Default is 0 (iterate until convergence). More...
int | GetMaxIterations ()
| Gets the maximum number of iterations to be performed during optimization. Default is 0 (iterate until convergence). More...
void | SetMaxIterations (int iter)
| Sets the maximum number of iterations to be performed during optimization. Default is 0 (iterate until convergence). More...
int | GetIterations ()
| Gets the number of iterations performed in the last call to IOptimizationMethod.Minimize(). More...
Public Member Functions inherited from NeuralEngine::MachineLearning::BaseOptimizationMethod< Scalar >
virtual int | GetNumberOfVariables ()
| Gets the number of variables (free parameters) in the optimization problem. More...
virtual af::array | GetSolution ()
| Gets the current solution found, the values of the parameters which optimizes the function. More...
virtual void | SetSolution (af::array &x)
| Sets the current solution found, the values of the parameters which optimizes the function. More...
virtual Scalar | GetValue ()
| Gets the output of the function at the current Solution. More...
virtual bool | Maximize (af::array &values, int *cycle=nullptr)
| Finds the maximum value of a function. The solution vector will be made available at the Solution property. More...
virtual bool | Minimize (af::array &values, int *cycle=nullptr)
| Finds the minimum value of a function. The solution vector will be made available at the Solution property. More...
virtual bool | Maximize (int *cycle=nullptr)
| Finds the maximum value of a function. The solution vector will be made available at the Solution property. More...
virtual bool | Minimize (int *cycle=nullptr)
| Finds the minimum value of a function. The solution vector will be made available at the Solution property. More...
void | Display (bool display)
| Set to display optimization information. More...
virtual int | GetNumberOfVariables ()=0
| Gets the number of variables (free parameters) in the optimization problem. More...
virtual af::array | GetSolution ()=0
| Gets the current solution found, the values of the parameters which optimizes the function. More...
virtual void | SetSolution (af::array &x)=0
| Gets a solution. More...
virtual Scalar | GetValue ()=0
| Gets the output of the function at the current Solution. More...
virtual bool | Minimize (int *cycle=nullptr)=0
| Finds the minimum value of a function. The solution vector will be made available at the Solution property. More...
virtual bool | Maximize (int *cycle=nullptr)=0
| Finds the maximum value of a function. The solution vector will be made available at the Solution property. More...

## Protected Member Functions
| BaseGradientOptimizationMethod (int numberOfVariables)
| Initializes a new instance of the BaseGradientOptimizationMethod class. More...
| BaseGradientOptimizationMethod (int numberOfVariables, std::function< Scalar(const af::array &, af::array &)> function)
| Initializes a new instance of the BaseGradientOptimizationMethod class. More...
| BaseGradientOptimizationMethod (NonlinearObjectiveFunction< Scalar > *function)
| Initializes a new instance of the BaseGradientOptimizationMethod class. More...
void | InitLinesearch ()
| Inits linesearch. More...
Protected Member Functions inherited from NeuralEngine::MachineLearning::BaseOptimizationMethod< Scalar >
void | SetValue (Scalar v)
| Sets the output of the function at the current Solution. More...
void | SetNumberOfVariables (int n)
| Sets the number of variables (free parameters) in the optimization problem. More...
| BaseOptimizationMethod (int numberOfVariables)
| Initializes a new instance of the BaseOptimizationMethod class. More...
| BaseOptimizationMethod (int numberOfVariables, std::function< Scalar(const af::array &, af::array &)> function)
| Initializes a new instance of the BaseOptimizationMethod class. More...
| BaseOptimizationMethod (NonlinearObjectiveFunction< Scalar > *function)
| Initializes a new instance of the BaseOptimizationMethod class. More...
virtual bool | Optimize (int *cycle=nullptr)=0
| Implements the actual optimization algorithm. This method should try to minimize the objective function. More...

## Protected Attributes
int | maxIterations
Scalar | _tolerance
int | iterations
ILineSearch< Scalar > * | linesearch
Protected Attributes inherited from NeuralEngine::MachineLearning::BaseOptimizationMethod< Scalar >
NonlinearObjectiveFunction< Scalar > * | _function
af::array | _x
bool | _display
af::dtype | m_dtype

## Detailed Description

template<typename Scalar, LineSearchType LSType = MoreThuente>
class NeuralEngine::MachineLearning::BaseGradientOptimizationMethod< Scalar, LSType >

Base class for gradient-based optimization methods.

HmetalT, 26.03.2017.

Definition at line 39 of file BaseGradientOptimizationMethod.h.

## Constructor & Destructor Documentation

## ◆ BaseGradientOptimizationMethod() [1/3]

template<typename Scalar , LineSearchType LSType = MoreThuente>

NeuralEngine::MachineLearning::BaseGradientOptimizationMethod< Scalar, LSType >::BaseGradientOptimizationMethod | ( | int | numberOfVariables | ) |
| protected

Initializes a new instance of the BaseGradientOptimizationMethod class.

Hmetal T, 26.03.2017.

Parameters

  numberOfVariables | The number of free parameters in the optimization problem.

## ◆ BaseGradientOptimizationMethod() [2/3]

template<typename Scalar , LineSearchType LSType = MoreThuente>

NeuralEngine::MachineLearning::BaseGradientOptimizationMethod< Scalar, LSType >::BaseGradientOptimizationMethod | ( | int | numberOfVariables,
|  | std::function< Scalar(const af::array &, af::array &)> | function
| ) |  |
| protected

Initializes a new instance of the BaseGradientOptimizationMethod class.

Hmetal T, 26.03.2017.

Parameters

  numberOfVariables | The number of free parameters in the optimization problem.
  function | [in,out] The objective function whose optimum values should be found.
  gradient | [in,out] The gradient of the objective function .

## ◆ BaseGradientOptimizationMethod() [3/3]

template<typename Scalar , LineSearchType LSType = MoreThuente>

NeuralEngine::MachineLearning::BaseGradientOptimizationMethod< Scalar, LSType >::BaseGradientOptimizationMethod | ( | NonlinearObjectiveFunction< Scalar > * | function | ) |
| protected

Initializes a new instance of the BaseGradientOptimizationMethod class.

Hmetal T, 17.03.2017.

Parameters

  function | The objective function and gradients whose optimum values should be found.

## Member Function Documentation

## ◆ GetTolerance()

template<typename Scalar , LineSearchType LSType = MoreThuente>

Scalar NeuralEngine::MachineLearning::BaseGradientOptimizationMethod< Scalar, LSType >::GetTolerance | ( |  | ) |

Gets the relative difference threshold to be used as stopping criteria between two iterations. Default is 0 (iterate until convergence).

Admin, 3/27/2017.

Returns
  The tolerance.

## ◆ SetTolerance()

template<typename Scalar , LineSearchType LSType = MoreThuente>

void NeuralEngine::MachineLearning::BaseGradientOptimizationMethod< Scalar, LSType >::SetTolerance | ( | Scalar | tolerance | ) |

Sets the relative difference threshold to be used as stopping criteria between two iterations. Default is 0 (iterate until convergence).

Admin, 3/27/2017.

Returns
  The tolerance.

## ◆ GetMaxIterations()

template<typename Scalar , LineSearchType LSType = MoreThuente>

int NeuralEngine::MachineLearning::BaseGradientOptimizationMethod< Scalar, LSType >::GetMaxIterations | ( |  | ) |

Gets the maximum number of iterations to be performed during optimization. Default is 0 (iterate until convergence).

Admin, 3/27/2017.

Returns
  The maximum iterations.

## ◆ SetMaxIterations()

template<typename Scalar , LineSearchType LSType = MoreThuente>

void NeuralEngine::MachineLearning::BaseGradientOptimizationMethod< Scalar, LSType >::SetMaxIterations | ( | int | iter | ) |

Sets the maximum number of iterations to be performed during optimization. Default is 0 (iterate until convergence).

Admin, 3/27/2017.

Parameters

  iter | The iterator.

## ◆ GetIterations()

template<typename Scalar , LineSearchType LSType = MoreThuente>

int NeuralEngine::MachineLearning::BaseGradientOptimizationMethod< Scalar, LSType >::GetIterations | ( |  | ) |

Gets the number of iterations performed in the last call to IOptimizationMethod.Minimize().

Admin, 3/27/2017.

Returns
  The number of iterations performed in the previous optimization.

## ◆ InitLinesearch()

template<typename Scalar , LineSearchType LSType = MoreThuente>

void NeuralEngine::MachineLearning::BaseGradientOptimizationMethod< Scalar, LSType >::InitLinesearch | ( |  | ) |
| protected

Inits linesearch.

Hmetal T, 11/06/2019.

## Member Data Documentation

## ◆ maxIterations

template<typename Scalar , LineSearchType LSType = MoreThuente>

int NeuralEngine::MachineLearning::BaseGradientOptimizationMethod< Scalar, LSType >::maxIterations
| protected

Definition at line 270 of file BaseGradientOptimizationMethod.h.

## ◆ _tolerance

template<typename Scalar , LineSearchType LSType = MoreThuente>

Scalar NeuralEngine::MachineLearning::BaseGradientOptimizationMethod< Scalar, LSType >::_tolerance
| protected

Definition at line 271 of file BaseGradientOptimizationMethod.h.

## ◆ iterations

template<typename Scalar , LineSearchType LSType = MoreThuente>

int NeuralEngine::MachineLearning::BaseGradientOptimizationMethod< Scalar, LSType >::iterations
| protected

Definition at line 272 of file BaseGradientOptimizationMethod.h.

## ◆ linesearch

template<typename Scalar , LineSearchType LSType = MoreThuente>

ILineSearch<Scalar>* NeuralEngine::MachineLearning::BaseGradientOptimizationMethod< Scalar, LSType >::linesearch
| protected

Definition at line 274 of file BaseGradientOptimizationMethod.h.

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

- BaseGradientOptimizationMethod.h