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

FgDeepGPBaseModel.h
1
11#pragma once
12
13#include <MachineLearning/FgIModel.h>
14#include <MachineLearning/FgLikelihoodBaseLayer.h>
15#include <MachineLearning/FgGPBaseLayer.h>
16
17 namespace NeuralEngine
18{
19 namespace MachineLearning
20 {
21 namespace GPModels
22 {
23 namespace PowerEP
24 {
25 template<typename Scalar>
26 class SGPLayer;
27 }
28
29 namespace AEP
30 {
31 template<typename Scalar>
32 class SGPLayer;
33 }
34
35 namespace VFE
36 {
37 //template<Scalar>
38 class SGPLayer;
39 }
40
49 template<typename Scalar>
50 class NE_IMPEXP DeepGPBaseModel : public GPBaseModel<Scalar>
51 {
52 public:
53
64 DeepGPBaseModel(const af::array& Y, HiddenLayerDescription hiddenLayerdescription, LogLikType lType = LogLikType::Gaussian);
65
76 DeepGPBaseModel(const af::array& Y, std::vector<HiddenLayerDescription> descriptions, LogLikType lType = LogLikType::Gaussian);
77
84 DeepGPBaseModel();
85
91 virtual ~DeepGPBaseModel();
92
102 virtual void PredictF(const af::array& testInputs, af::array& mf, af::array& vf) override;
103
113 virtual void SampleY(const af::array inputs, int numSamples, af::array& outFunctions) override;
114
122 virtual int GetNumParameters() override;
123
131 virtual int GetNumLayers();
132
140 virtual void SetParameters(const af::array& param) override;
141
149 virtual af::array GetParameters() override;
150
156 virtual void UpdateParameters() override;
157
165 virtual std::vector<GPBaseLayer<Scalar>*> GetGPLayers();
166
174 virtual void FixKernelParameters(bool isfixed);
175
176 protected:
177 int iNumLayer; //< number of gp layers
178
179 std::vector<int> vNumPseudosPerLayer;
180 std::vector<int> vSize;
181
182 std::vector<GPBaseLayer<Scalar>*> gpLayer;
183
184 private:
185 friend class boost::serialization::access;
186
187 friend class AEP::SGPLayer<Scalar>;
188 friend class PowerEP::SGPLayer<Scalar>;
189 //friend class VFE::SGPLayer/*<Scalar>*/;
190
191 template<class Archive>
192 void serialize(Archive& ar, unsigned int version)
193 {
194 ar& boost::serialization::base_object<GPBaseModel<Scalar>>(*this);
195
196 //ar& boost::serialization::make_nvp("GPBaseModel", boost::serialization::base_object<GPBaseModel<Scalar>>(*this));
197
198 ar.register_type<AEP::SGPLayer<Scalar>>();
199 ar.register_type<PowerEP::SGPLayer<Scalar>>();
200 /*ar.register_type<VFE::SGPLayer>();*/
201
202 ar& BOOST_SERIALIZATION_NVP(gpLayer);
203 ar& BOOST_SERIALIZATION_NVP(iNumLayer);
204 ar& BOOST_SERIALIZATION_NVP(vNumPseudosPerLayer);
205 ar& BOOST_SERIALIZATION_NVP(vSize);
206 }
207 };
208 }
209 }
210}
NeuralEngine::MachineLearning::GPModels::AEP::SGPLayer
Sparse GP layer.
Definition: FgAEPSparseGPLayer.h:40
NeuralEngine::MachineLearning::GPModels::DeepGPBaseModel
Base class with abstract and basic function definitions. All deep GP models will be derived from this...
Definition: FgDeepGPBaseModel.h:51
NeuralEngine::MachineLearning::GPModels::DeepGPBaseModel::~DeepGPBaseModel
virtual ~DeepGPBaseModel()
Destructor.
NeuralEngine::MachineLearning::GPModels::DeepGPBaseModel::DeepGPBaseModel
DeepGPBaseModel(const af::array &Y, std::vector< HiddenLayerDescription > descriptions, LogLikType lType=LogLikType::Gaussian)
Constructor.
NeuralEngine::MachineLearning::GPModels::DeepGPBaseModel::DeepGPBaseModel
DeepGPBaseModel(const af::array &Y, HiddenLayerDescription hiddenLayerdescription, LogLikType lType=LogLikType::Gaussian)
Constructor.
NeuralEngine::MachineLearning::GPModels::DeepGPBaseModel::DeepGPBaseModel
DeepGPBaseModel()
Default Constructor.
NeuralEngine::MachineLearning::GPModels::DeepGPBaseModel::PredictF
virtual void PredictF(const af::array &testInputs, af::array &mf, af::array &vf) override
Predict noise free functions values .
NeuralEngine::MachineLearning::GPModels::DeepGPBaseModel::SetParameters
virtual void SetParameters(const af::array &param) override
Sets the parameters for each optimization iteration.
NeuralEngine::MachineLearning::GPModels::DeepGPBaseModel::GetNumParameters
virtual int GetNumParameters() override
Gets number of parameters.
NeuralEngine::MachineLearning::GPModels::DeepGPBaseModel::SampleY
virtual void SampleY(const af::array inputs, int numSamples, af::array &outFunctions) override
Generate function samples from posterior.
NeuralEngine::MachineLearning::GPModels::DeepGPBaseModel::FixKernelParameters
virtual void FixKernelParameters(bool isfixed)
Sets fixation for hyperparameters.
NeuralEngine::MachineLearning::GPModels::DeepGPBaseModel::GetParameters
virtual af::array GetParameters() override
Gets the parameters for each optimization iteration.
NeuralEngine::MachineLearning::GPModels::DeepGPBaseModel::UpdateParameters
virtual void UpdateParameters() override
Updates the parameters.
NeuralEngine::MachineLearning::GPModels::DeepGPBaseModel::GetGPLayers
virtual std::vector< GPBaseLayer< Scalar > * > GetGPLayers()
Gets vector of GP layers.
NeuralEngine::MachineLearning::GPModels::DeepGPBaseModel::GetNumLayers
virtual int GetNumLayers()
Gets number of GP layers.
NeuralEngine::MachineLearning::GPModels::GPBaseModel
Base class with abstract and basic function definitions. All GP models will be derived from this clas...
Definition: FgGPBaseModel.h:40
NeuralEngine::MachineLearning::GPModels::PowerEP::SGPLayer
Sparse GP layer.
Definition: FgPEPSparseGPLayer.h:38
NeuralEngine::MachineLearning::HiddenLayerDescription
Description of the layer.
Definition: FgIModel.h:36
Scalar
NeuralEngine
Definition: NeArray2.h:18