NeuralEngine
A Game Engine with embeded Machine Learning algorithms based on Gaussian Processes.
FgIBackconstraint.h
1
11#pragma once
12
13#include <NeMachineLearningLib.h>
14#include <MachineLearning/CommonUtil.h>
15
16namespace NeuralEngine
17{
18 namespace MachineLearning
19 {
20 namespace GPModels
21 {
22 enum class BackConstType
23 {
24 kbr, // Kernel-based regression back constraint function.
25 mlp, // Multi-layer perceptron back constraint function.
26 ptc, // periodic topological constraint
27 halfPtc, // half circle periodic topological constraint
28 ptcLinear,
29 ptcHardCircle
30 };
31
40 template<typename Scalar>
41 class NE_IMPEXP IBackconstraint
42 {
43 public:
44
52 IBackconstraint(BackConstType type);
53
60
69 virtual void Init(const af::array& Y, const af::array& X, const af::array& segments) = 0;
70
78 virtual int GetNumParameters() = 0;
79
87 virtual void SetParameters(const af::array& param) = 0;
88
96 virtual af::array GetParameters() = 0;
97
105 virtual af::array GetConstraintX() = 0;
106
116 virtual af::array BackconstraintGradient(const af::array& gX) = 0;
117
125 BackConstType GetType();
126
127 protected:
128 int iN;
129 int iq;
130
131 af::dtype m_dType;
132
133 private:
134 BackConstType backType;
135
136 friend class boost::serialization::access;
137
138 template<class Archive>
139 void serialize(Archive& ar, unsigned int version)
140 {
141 ar& BOOST_SERIALIZATION_NVP(iN);
142 ar& BOOST_SERIALIZATION_NVP(iq);
143 ar& BOOST_SERIALIZATION_NVP(backType);
144 }
145 };
146 }
147 }
148}
Abstract class for back-constraints, a kind of prior knowledge to force topological positions of unce...
virtual af::array GetParameters()=0
Gets the parameters.
af::dtype m_dType
floating point precision flag for af::array
virtual void Init(const af::array &Y, const af::array &X, const af::array &segments)=0
Initializes this object.
virtual int GetNumParameters()=0
Gets number of to be optimized parameters.
BackConstType GetType()
Gets the back-constraint type.
virtual af::array BackconstraintGradient(const af::array &gX)=0
Back-constraint gradient.
virtual af::array GetConstraintX()=0
Gets constraint x coordinates.
virtual void SetParameters(const af::array &param)=0
Sets the parameters.