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

FgSparseGPLVMBaseModel.h
1
11#pragma once
12
13#include <MachineLearning/FgGPLVMBaseModel.h>
14#include <MachineLearning/FgSparseGPBaseLayer.h>
15
16 namespace NeuralEngine
17{
18 namespace MachineLearning
19 {
20 namespace GPModels
21 {
22 namespace PowerEP
23 {
24 template<typename Scalar>
25 class SGPLayer;
26 }
27
28 namespace AEP
29 {
30 template<typename Scalar>
31 class SGPLayer;
32 }
33
34 //namespace VFE
35 //{
36 // //template<Scalar>
37 // class SGPLayer;
38 //}
39
77 template<typename Scalar>
78 class NE_IMPEXP SparseGPLVMBaseModel : public GPLVMBaseModel<Scalar>
79 {
80 public:
81
95 SparseGPLVMBaseModel(const af::array& Y, int latentDimension, Scalar priorMean = 0.0, Scalar priorVariance = 1.0,
96 int numInducing = 200, LogLikType lType = LogLikType::Gaussian, XInit emethod = XInit::pca);
97
103 SparseGPLVMBaseModel();
104
110 virtual ~SparseGPLVMBaseModel();
111
121 virtual void PredictF(const af::array& testInputs, af::array& mf, af::array& vf) override;
122
132 virtual void SampleY(const af::array inputs, int numSamples, af::array& outFunctions) override;
133
141 virtual bool Init() override;
142
150 virtual int GetNumParameters() override;
151
159 virtual void SetParameters(const af::array& param) override;
160
168 virtual af::array GetParameters() override;
169
175 virtual void UpdateParameters() override;
176
184 virtual void FixKernelParameters(bool isfixed) override;
185
193 virtual void FixInducing(bool isfixed) override;
194
195 protected:
196
197 int ik;
198 SparseGPBaseLayer<Scalar>* gpLayer;
199
200 private:
201 friend class AEP::SGPLayer<Scalar>;
202 friend class PowerEP::SGPLayer<Scalar>;
203 //friend class VFE::SGPLayer/*<Scalar>*/;
204
205 friend class boost::serialization::access;
206
207 template<class Archive>
208 void serialize(Archive& ar, unsigned int version)
209 {
210 ar& boost::serialization::base_object<GPLVMBaseModel<Scalar>>(*this);
211
212 //ar& boost::serialization::make_nvp("GPLVMBaseModel", boost::serialization::base_object<GPLVMBaseModel<Scalar>>(*this));
213
214 ar.register_type<AEP::SGPLayer<Scalar>>();
215 ar.register_type<PowerEP::SGPLayer<Scalar>>();
216 //ar.register_type<VFE::SGPLayer>();
217
218 ar& BOOST_SERIALIZATION_NVP(ik);
219 ar& BOOST_SERIALIZATION_NVP(gpLayer);
220 }
221 };
222}
223 }
224}
NeuralEngine::MachineLearning::GPModels::AEP::SGPLayer
Sparse GP layer.
Definition: FgAEPSparseGPLayer.h:40
NeuralEngine::MachineLearning::GPModels::GPLVMBaseModel
Base class with abstract and basic function definitions. All deep GP models will be derived from this...
Definition: FgGPLVMBaseModel.h:295
NeuralEngine::MachineLearning::GPModels::PowerEP::SGPLayer
Sparse GP layer.
Definition: FgPEPSparseGPLayer.h:38
NeuralEngine::MachineLearning::GPModels::SparseGPBaseLayer
Abstract class for different GP likelihood layers.
Definition: FgSparseGPBaseLayer.h:35
NeuralEngine::MachineLearning::GPModels::SparseGPLVMBaseModel
Base class for all sparse GPLVM models.
Definition: FgSparseGPLVMBaseModel.h:79
NeuralEngine::MachineLearning::GPModels::SparseGPLVMBaseModel::SetParameters
virtual void SetParameters(const af::array &param) override
Sets the parameters for each optimization iteration.
NeuralEngine::MachineLearning::GPModels::SparseGPLVMBaseModel::PredictF
virtual void PredictF(const af::array &testInputs, af::array &mf, af::array &vf) override
Predict noise free functions values .
NeuralEngine::MachineLearning::GPModels::SparseGPLVMBaseModel::gpLayer
SparseGPBaseLayer< Scalar > * gpLayer
sparse Gaussian Process layer
Definition: FgSparseGPLVMBaseModel.h:198
NeuralEngine::MachineLearning::GPModels::SparseGPLVMBaseModel::~SparseGPLVMBaseModel
virtual ~SparseGPLVMBaseModel()
Destructor.
NeuralEngine::MachineLearning::GPModels::SparseGPLVMBaseModel::FixKernelParameters
virtual void FixKernelParameters(bool isfixed) override
Sets fixation for hyperparameters.
NeuralEngine::MachineLearning::GPModels::SparseGPLVMBaseModel::SparseGPLVMBaseModel
SparseGPLVMBaseModel()
Default constructor.
NeuralEngine::MachineLearning::GPModels::SparseGPLVMBaseModel::Init
virtual bool Init() override
Initializes the model.
NeuralEngine::MachineLearning::GPModels::SparseGPLVMBaseModel::FixInducing
virtual void FixInducing(bool isfixed) override
Set fixation for inducing inputs.
NeuralEngine::MachineLearning::GPModels::SparseGPLVMBaseModel::SampleY
virtual void SampleY(const af::array inputs, int numSamples, af::array &outFunctions) override
Generate function samples from posterior.
NeuralEngine::MachineLearning::GPModels::SparseGPLVMBaseModel::ik
int ik
number of inducing inputs
Definition: FgSparseGPLVMBaseModel.h:197
NeuralEngine::MachineLearning::GPModels::SparseGPLVMBaseModel::GetNumParameters
virtual int GetNumParameters() override
Gets number of parameters.
NeuralEngine::MachineLearning::GPModels::SparseGPLVMBaseModel::UpdateParameters
virtual void UpdateParameters() override
Updates the parameters.
NeuralEngine::MachineLearning::GPModels::SparseGPLVMBaseModel::SparseGPLVMBaseModel
SparseGPLVMBaseModel(const af::array &Y, int latentDimension, Scalar priorMean=0.0, Scalar priorVariance=1.0, int numInducing=200, LogLikType lType=LogLikType::Gaussian, XInit emethod=XInit::pca)
Constructor.
NeuralEngine::MachineLearning::GPModels::SparseGPLVMBaseModel::GetParameters
virtual af::array GetParameters() override
Gets the parameters for each optimization iteration.
Scalar
NeuralEngine
Definition: NeArray2.h:18