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

FgAEPSparseGPSSM.h
1
11#pragma once
12
13#include <MachineLearning/FgSparseGPSSMBaseModel.h>
14
15 namespace NeuralEngine
16{
17 namespace MachineLearning
18 {
19 namespace GPModels
20 {
21 namespace AEP
22 {
55 template<typename Scalar>
56 class NE_IMPEXP SGPSSM : public SparseGPSSMBaseModel<Scalar>
57 {
58 public:
75 SGPSSM(const af::array& Y, int latentDimension, int numInducing = 200, Scalar alpha = 1.0, Scalar priorMean = 0.0,
76 Scalar priorVariance = 1.0, af::array xControl = af::array(),
77 PropagationMode probMode = PropagationMode::MonteCarlo, LogLikType lType = LogLikType::Gaussian,
78 bool GPemission = false, bool controlToEmiss = false, XInit emethod = XInit::pca);
79
80 virtual ~SGPSSM();
81
92 virtual Scalar Function(const af::array& x, af::array& outGradient) override;
93
94 SGPSSM();
95
96 protected:
97
108 virtual void CavityLatents(af::array& mcav, af::array& vcav, af::array& cav1, af::array& cav2);
109
127 Scalar ComputeTiltedTransition(const af::array& mprob, const af::array& vprob, const af::array& mcav_t1, const af::array& vcav_t1,
128 Scalar scaleLogZDyn, af::array& dlogZ_dmProb, af::array& dlogZ_dvProb, af::array& dlogZ_dmt, af::array& dlogZ_dvt, Scalar& dlogZ_sn);
129
137 virtual af::array PosteriorGradientLatents();
138
149 virtual af::array CavityGradientLatents(const af::array& cav1, const af::array& cav2);
150
167 virtual af::array LogZGradientLatents(const af::array& cav1, const af::array& cav2, const af::array& dmcav_up, const af::array& dvcav_up,
168 const af::array& dmcav_prev, const af::array& dvcav_prev, const af::array& dmcav_next, const af::array& dvcav_next);
169
177 virtual Scalar ComputePhiPriorLatents();
178
186 virtual Scalar ComputePhiCavityLatents();
187
195 virtual Scalar ComputePhiPosteriorLatents();
196
197 private:
198 Scalar dAlpha;
199
200 friend class boost::serialization::access;
201
202 template<class Archive>
203 void serialize(Archive& ar, unsigned int version)
204 {
205 ar& boost::serialization::base_object<SparseGPSSMBaseModel<Scalar>>(*this);
206 //ar& boost::serialization::make_nvp("SparseGPSSMBaseModel", boost::serialization::base_object<SparseGPSSMBaseModel<Scalar>>(*this));
207 ar& BOOST_SERIALIZATION_NVP(dAlpha);
208 }
209 };
210
211 }
212 }
213 }
214}
NeuralEngine::MachineLearning::GPModels::AEP::SGPSSM
Sparse GPSSM via Approximated Expectation Propagation (AEP).
Definition: FgAEPSparseGPSSM.h:57
NeuralEngine::MachineLearning::GPModels::AEP::SGPSSM::ComputePhiPriorLatents
virtual Scalar ComputePhiPriorLatents()
Calculates the phi prior.
NeuralEngine::MachineLearning::GPModels::AEP::SGPSSM::ComputePhiPosteriorLatents
virtual Scalar ComputePhiPosteriorLatents()
Calculates the phi posterior.
NeuralEngine::MachineLearning::GPModels::AEP::SGPSSM::ComputeTiltedTransition
Scalar ComputeTiltedTransition(const af::array &mprob, const af::array &vprob, const af::array &mcav_t1, const af::array &vcav_t1, Scalar scaleLogZDyn, af::array &dlogZ_dmProb, af::array &dlogZ_dvProb, af::array &dlogZ_dmt, af::array &dlogZ_dvt, Scalar &dlogZ_sn)
Calculates the tilted transition.
NeuralEngine::MachineLearning::GPModels::AEP::SGPSSM::LogZGradientLatents
virtual af::array LogZGradientLatents(const af::array &cav1, const af::array &cav2, const af::array &dmcav_up, const af::array &dvcav_up, const af::array &dmcav_prev, const af::array &dvcav_prev, const af::array &dmcav_next, const af::array &dvcav_next)
LogZ gradient w.r.t .
NeuralEngine::MachineLearning::GPModels::AEP::SGPSSM::PosteriorGradientLatents
virtual af::array PosteriorGradientLatents()
Posterior gradient w.r.t .
NeuralEngine::MachineLearning::GPModels::AEP::SGPSSM::Function
virtual Scalar Function(const af::array &x, af::array &outGradient) override
Cost function the given parameter inputs.
NeuralEngine::MachineLearning::GPModels::AEP::SGPSSM::CavityGradientLatents
virtual af::array CavityGradientLatents(const af::array &cav1, const af::array &cav2)
Cavity gradient w.r.t .
NeuralEngine::MachineLearning::GPModels::AEP::SGPSSM::dAlpha
Scalar dAlpha
fraction parameter
Definition: FgAEPSparseGPSSM.h:198
NeuralEngine::MachineLearning::GPModels::AEP::SGPSSM::ComputePhiCavityLatents
virtual Scalar ComputePhiCavityLatents()
Calculates the phi cavity.
NeuralEngine::MachineLearning::GPModels::AEP::SGPSSM::SGPSSM
SGPSSM(const af::array &Y, int latentDimension, int numInducing=200, Scalar alpha=1.0, Scalar priorMean=0.0, Scalar priorVariance=1.0, af::array xControl=af::array(), PropagationMode probMode=PropagationMode::MonteCarlo, LogLikType lType=LogLikType::Gaussian, bool GPemission=false, bool controlToEmiss=false, XInit emethod=XInit::pca)
Constructor.
NeuralEngine::MachineLearning::GPModels::AEP::SGPSSM::CavityLatents
virtual void CavityLatents(af::array &mcav, af::array &vcav, af::array &cav1, af::array &cav2)
Computes the cavity distribution.
NeuralEngine::MachineLearning::GPModels::SparseGPSSMBaseModel
Base class for all sparse GPSSM models.
Definition: FgSparseGPSSMBaseModel.h:101
Scalar
NeuralEngine
Definition: NeArray2.h:18