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

FgGaussLikelihoodLayer.h
1
11#pragma once
12
13#include <MachineLearning/FgLikelihoodBaseLayer.h>
14
15 namespace NeuralEngine
16{
17 namespace MachineLearning
18 {
19 namespace GPModels
20 {
49 template<typename Scalar>
50 class NE_IMPEXP GaussLikLayer : public LikelihoodBaseLayer<Scalar>
51 {
52 public:
53
62 GaussLikLayer(int numPoints, int outputDim);
63
69 ~GaussLikLayer();
70
86 Scalar ComputeLogZ(const af::array& mout, const af::array& vout, const af::array& y, Scalar alpha = 1.0, af::array* dlogZ_dm = nullptr,
87 af::array* dlogZ_dv = nullptr, af::array* dlogZ_dm2 = nullptr);
88
101 void ComputeLogZGradients(const af::array& mout, const af::array& vout, const af::array& y, af::array* dlogZ_dm = nullptr,
102 af::array* dlogZ_dv = nullptr, af::array* dlogZ_dm2 = nullptr, Scalar alpha = 1.0);
103
104 Scalar ComputeLogLikExp(const af::array& mout, const af::array& vout, const af::array& y);
105
106 void ComputeLogLikExpGradients(const af::array& mout, const af::array& vout, const af::array& y, af::array* de_dm = nullptr, af::array* de_dv = nullptr);
107
108 Scalar BackpropagationGradients(const af::array& mout, const af::array& vout, af::array& dmout, af::array& dvout, Scalar alpha = 1.0, Scalar scale = 1.0);
109
110 Scalar BackpropagationGradientsLogLikExp(const af::array& mout, const af::array& vout, af::array& dmout, af::array& dvout, af::array& y, Scalar scale = 1.0);
111
112 void ProbabilisticOutput(const af::array& mf, const af::array& vf, af::array& myOut, af::array& vyOut, Scalar alpha = 1.0f);
113
121 virtual int GetNumParameters() override;
122
130 virtual void SetParameters(const af::array& param) override;
131
139 virtual af::array GetParameters() override;
140
146 virtual void UpdateParameters() override;
147
148 protected:
149
155 GaussLikLayer() { }
156
157 private:
158
159 Scalar _sn;
160
161 friend class boost::serialization::access;
162
163 template<class Archive>
164 void serialize(Archive& ar, unsigned int version)
165 {
166 ar& boost::serialization::base_object<LikelihoodBaseLayer<Scalar>>(*this);
167
168 ar& BOOST_SERIALIZATION_NVP(_sn);
169 }
170 };
171 }
172 }
173}
NeuralEngine::MachineLearning::GPModels::GaussLikLayer
Likelihood estimation based on Gaussian distribution.
Definition: FgGaussLikelihoodLayer.h:51
NeuralEngine::MachineLearning::GPModels::GaussLikLayer::GetNumParameters
virtual int GetNumParameters() override
Gets number of parameters to be optimized.
NeuralEngine::MachineLearning::GPModels::GaussLikLayer::ComputeLogZGradients
void ComputeLogZGradients(const af::array &mout, const af::array &vout, const af::array &y, af::array *dlogZ_dm=nullptr, af::array *dlogZ_dv=nullptr, af::array *dlogZ_dm2=nullptr, Scalar alpha=1.0)
Calculates the logZ gradients.
NeuralEngine::MachineLearning::GPModels::GaussLikLayer::ComputeLogZ
Scalar ComputeLogZ(const af::array &mout, const af::array &vout, const af::array &y, Scalar alpha=1.0, af::array *dlogZ_dm=nullptr, af::array *dlogZ_dv=nullptr, af::array *dlogZ_dm2=nullptr)
Calculates the logZ.
NeuralEngine::MachineLearning::GPModels::GaussLikLayer::GaussLikLayer
GaussLikLayer(int numPoints, int outputDim)
Constructor.
NeuralEngine::MachineLearning::GPModels::GaussLikLayer::~GaussLikLayer
~GaussLikLayer()
Destructor.
NeuralEngine::MachineLearning::GPModels::GaussLikLayer::GaussLikLayer
GaussLikLayer()
Default constructor.
Definition: FgGaussLikelihoodLayer.h:155
NeuralEngine::MachineLearning::GPModels::GaussLikLayer::UpdateParameters
virtual void UpdateParameters() override
Updates the parameters.
NeuralEngine::MachineLearning::GPModels::GaussLikLayer::GetParameters
virtual af::array GetParameters() override
Gets the parameters for each optimization iteration.
NeuralEngine::MachineLearning::GPModels::GaussLikLayer::SetParameters
virtual void SetParameters(const af::array &param) override
Sets the parameters for each optimization iteration.
NeuralEngine::MachineLearning::GPModels::LikelihoodBaseLayer
Abstract class for different GP likelihood layers.
Definition: FgLikelihoodBaseLayer.h:35
Scalar
NeuralEngine
Definition: NeArray2.h:18