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

FgAdaMaxSolver.h
1
11#pragma once
12
13#include <MachineLearning/BaseGradientOptimizationMethod.h>
14
15 namespace NeuralEngine
16{
17 namespace MachineLearning
18 {
58 template<typename Scalar, LineSearchType LSType = MoreThuente>
59 class NE_IMPEXP AdaMaxSolver : public BaseGradientOptimizationMethod<Scalar, LSType>
60 {
61 public:
62
72 AdaMaxSolver(int numberOfVariables);
73
85 AdaMaxSolver(int numberOfVariables,
86 std::function<Scalar(const af::array&, af::array&)> function);
87
95 AdaMaxSolver(NonlinearObjectiveFunction<Scalar>* function);
96
102 ~AdaMaxSolver();
103
111 void SetBeta1(Scalar beta1);
112
120 void SetBeta2(Scalar beta2);
121
129 void SetAlpha(Scalar alpha);
130
138 void SetEpsilon(Scalar epsilon);
139
147 void SetDecay(Scalar decay);
148
156 Scalar GetBeta1();
157
165 Scalar GetBeta2();
166
174 Scalar GetAlpha();
175
183 Scalar GetEpsilon();
184
192 Scalar GetDecay();
193
194 protected:
195
206 virtual bool Optimize(int* cycle = nullptr) override;
207
208 private:
209 Scalar min_step; // The minimum step length allowed in the line search.
210 Scalar max_step; // The maximum step length allowed in the line search.
211
212 Scalar sAlpha; // learning rate
213 Scalar sBeta1; // exponential decay rate for the first moment estimates (e.g. 0.9)
214 Scalar sBeta2; // exponential decay rate for the second-moment estimates (e.g. 0.999).
215 Scalar sEpsilon; // small number to prevent any division by zero in the implementation
216 Scalar sDecay;
217 Scalar delta;
218 };
219 }
220}
NeuralEngine::MachineLearning::AdaMaxSolver
AdaMax optimizer.
Definition: FgAdaMaxSolver.h:60
NeuralEngine::MachineLearning::AdaMaxSolver::SetBeta1
void SetBeta1(Scalar beta1)
Sets decay rate for the first moment estimates.
NeuralEngine::MachineLearning::AdaMaxSolver::SetAlpha
void SetAlpha(Scalar alpha)
Sets the learning rate.
NeuralEngine::MachineLearning::AdaMaxSolver::SetDecay
void SetDecay(Scalar decay)
Sets initial decay rate.
NeuralEngine::MachineLearning::AdaMaxSolver::GetEpsilon
Scalar GetEpsilon()
Gets the epsilon.
NeuralEngine::MachineLearning::AdaMaxSolver::GetAlpha
Scalar GetAlpha()
Gets the learning rate.
NeuralEngine::MachineLearning::AdaMaxSolver::GetBeta1
Scalar GetBeta1()
Gets decay rate for the first moment estimates.
NeuralEngine::MachineLearning::AdaMaxSolver::~AdaMaxSolver
~AdaMaxSolver()
Destructor.
NeuralEngine::MachineLearning::AdaMaxSolver::SetEpsilon
void SetEpsilon(Scalar epsilon)
Sets an epsilon to avoid division by zero.
NeuralEngine::MachineLearning::AdaMaxSolver::GetBeta2
Scalar GetBeta2()
Gets decay rate for the second-moment estimates.
NeuralEngine::MachineLearning::AdaMaxSolver::AdaMaxSolver
AdaMaxSolver(NonlinearObjectiveFunction< Scalar > *function)
Creates a new instance of the L-BFGS optimization algorithm.
NeuralEngine::MachineLearning::AdaMaxSolver::GetDecay
Scalar GetDecay()
Gets the initial decay.
NeuralEngine::MachineLearning::AdaMaxSolver::AdaMaxSolver
AdaMaxSolver(int numberOfVariables)
Creates a new instance of the L-BFGS optimization algorithm.
NeuralEngine::MachineLearning::AdaMaxSolver::SetBeta2
void SetBeta2(Scalar beta2)
Sets decay rate for the second-moment estimates.
NeuralEngine::MachineLearning::AdaMaxSolver::Optimize
virtual bool Optimize(int *cycle=nullptr) override
Implements the actual optimization algorithm. This method should try to minimize the objective functi...
NeuralEngine::MachineLearning::AdaMaxSolver::AdaMaxSolver
AdaMaxSolver(int numberOfVariables, std::function< Scalar(const af::array &, af::array &)> function)
Creates a new instance of the L-BFGS optimization algorithm.
NeuralEngine::MachineLearning::BaseGradientOptimizationMethod
Base class for gradient-based optimization methods.
Definition: BaseGradientOptimizationMethod.h:40
NeuralEngine::MachineLearning::NonlinearObjectiveFunction
Definition: NonlinearObjectiveFunction.h:21
Scalar
NeuralEngine
Definition: NeArray2.h:18