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
15namespace 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
96
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
157
166
175
184
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}
void SetBeta1(Scalar beta1)
Sets decay rate for the first moment estimates.
void SetAlpha(Scalar alpha)
Sets the learning rate.
void SetDecay(Scalar decay)
Sets initial decay rate.
Scalar GetAlpha()
Gets the learning rate.
Scalar GetBeta1()
Gets decay rate for the first moment estimates.
void SetEpsilon(Scalar epsilon)
Sets an epsilon to avoid division by zero.
Scalar GetBeta2()
Gets decay rate for the second-moment estimates.
AdaMaxSolver(NonlinearObjectiveFunction< Scalar > *function)
Creates a new instance of the L-BFGS optimization algorithm.
Scalar GetDecay()
Gets the initial decay.
AdaMaxSolver(int numberOfVariables)
Creates a new instance of the L-BFGS optimization algorithm.
void SetBeta2(Scalar beta2)
Sets decay rate for the second-moment estimates.
virtual bool Optimize(int *cycle=nullptr) override
Implements the actual optimization algorithm. This method should try to minimize the objective functi...
AdaMaxSolver(int numberOfVariables, std::function< Scalar(const af::array &, af::array &)> function)
Creates a new instance of the L-BFGS optimization algorithm.