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
16 namespace 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
59 virtual ~IBackconstraint();
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}
NeuralEngine::MachineLearning::GPModels::IBackconstraint
Abstract class for back-constraints, a kind of prior knowledge to force topological positions of unce...
Definition: FgIBackconstraint.h:42
NeuralEngine::MachineLearning::GPModels::IBackconstraint::GetParameters
virtual af::array GetParameters()=0
Gets the parameters.
NeuralEngine::MachineLearning::GPModels::IBackconstraint::m_dType
af::dtype m_dType
floating point precision flag for af::array
Definition: FgIBackconstraint.h:131
NeuralEngine::MachineLearning::GPModels::IBackconstraint::Init
virtual void Init(const af::array &Y, const af::array &X, const af::array &segments)=0
Initializes this object.
NeuralEngine::MachineLearning::GPModels::IBackconstraint::IBackconstraint
IBackconstraint(BackConstType type)
Constructor.
NeuralEngine::MachineLearning::GPModels::IBackconstraint::GetNumParameters
virtual int GetNumParameters()=0
Gets number of to be optimized parameters.
NeuralEngine::MachineLearning::GPModels::IBackconstraint::iN
int iN
dataset length
Definition: FgIBackconstraint.h:128
NeuralEngine::MachineLearning::GPModels::IBackconstraint::GetType
BackConstType GetType()
Gets the back-constraint type.
NeuralEngine::MachineLearning::GPModels::IBackconstraint::~IBackconstraint
virtual ~IBackconstraint()
Destructor.
NeuralEngine::MachineLearning::GPModels::IBackconstraint::BackconstraintGradient
virtual af::array BackconstraintGradient(const af::array &gX)=0
Back-constraint gradient.
NeuralEngine::MachineLearning::GPModels::IBackconstraint::GetConstraintX
virtual af::array GetConstraintX()=0
Gets constraint x coordinates.
NeuralEngine::MachineLearning::GPModels::IBackconstraint::iq
int iq
latent dimension
Definition: FgIBackconstraint.h:129
NeuralEngine::MachineLearning::GPModels::IBackconstraint::SetParameters
virtual void SetParameters(const af::array &param)=0
Sets the parameters.
NeuralEngine
Definition: NeArray2.h:18