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

FgCompoundKernel.h
1
11#pragma once
12
13#include <MachineLearning/FgIKernel.h>
14
15 namespace NeuralEngine
16{
17 namespace MachineLearning
18 {
42 template<typename Scalar>
43 class NE_IMPEXP CompoundKernel : public IKernel<Scalar>
44 {
45 public:
51 CompoundKernel();
52
58 ~CompoundKernel();
59
71 void AddKernel(IKernel<Scalar>* kernel, af::array index);
72
82 void ComputeKernelMatrix(const af::array& inX1, const af::array& inX2, af::array& outMatrix);
83
92 void ComputeDiagonal(const af::array& inX, af::array& outDiagonal);
93
109 void LogLikGradientX(const af::array& inX, const af::array& indL_dK, af::array& outdL_dX);
110
123 void LogLikGradientX(const af::array& inXu, const af::array& indL_dKuu, const af::array& inX, const af::array& indL_dKuf, af::array& outdL_dXu, af::array& outdL_dX);
124
135 void LogLikGradientParam(const af::array& inX1, const af::array& inX2, const af::array& indL_dK, af::array& outdL_dParam);
136
147 void GradX(const af::array& inX1, const af::array& inX2, int q, af::array& outdK_dX);
148
157 void DiagGradX(const af::array& inX, af::array& outDiagdK_dX);
158
168 void DiagGradParam(const af::array& inX, const af::array& inCovDiag, af::array& outDiagdK_dParam);
169
177 void SetParameters(const af::array& param);
178
186 af::array GetParameters();
187
191
192 void Psi1Derivative(const af::array& inPsi1, const af::array& indL_dpsi1, const af::array& inZ, const af::array& inMu,
193 const af::array& inSu, af::array& outdL_dParam, af::array& outdL_dXu, af::array* outdL_dX = nullptr);
194
195 private:
196
197 friend class boost::serialization::access;
198
199 template<class Archive>
200 void serialize(Archive& ar, unsigned int version)
201 {
202 ar & boost::serialization::base_object<IKernel<Scalar>>(*this);
203 //ar& boost::serialization::make_nvp("IKernel", boost::serialization::base_object<IKernel<Scalar>>(*this));
204 ar& BOOST_SERIALIZATION_NVP(vKernel);
205 ar& BOOST_SERIALIZATION_NVP(vIndex);
206 }
207
208 //af::array afParameter; // []{variance, dInvScale}
209 std::vector<IKernel<Scalar>*> vKernel;
210 std::vector<af::array> vIndex;
211 };
212 }
213}
214
NeuralEngine::MachineLearning::CompoundKernel
Compound kernel function.
Definition: FgCompoundKernel.h:44
NeuralEngine::MachineLearning::CompoundKernel::LogLikGradientX
void LogLikGradientX(const af::array &inXu, const af::array &indL_dKuu, const af::array &inX, const af::array &indL_dKuf, af::array &outdL_dXu, af::array &outdL_dX)
Computes dL / dX and dL / dXu for sparse approximation GP.
NeuralEngine::MachineLearning::CompoundKernel::CompoundKernel
CompoundKernel()
Default constructor.
NeuralEngine::MachineLearning::CompoundKernel::GetParameters
af::array GetParameters()
Gets the parameters.
NeuralEngine::MachineLearning::CompoundKernel::DiagGradX
void DiagGradX(const af::array &inX, af::array &outDiagdK_dX)
Derivative of diagonal elemts of K w.r.t X.
NeuralEngine::MachineLearning::CompoundKernel::~CompoundKernel
~CompoundKernel()
Destructor.
NeuralEngine::MachineLearning::CompoundKernel::Psi1Derivative
void Psi1Derivative(const af::array &inPsi1, const af::array &indL_dpsi1, const af::array &inZ, const af::array &inMu, const af::array &inSu, af::array &outdL_dParam, af::array &outdL_dXu, af::array *outdL_dX=nullptr)
PSI statistics.
NeuralEngine::MachineLearning::CompoundKernel::GradX
void GradX(const af::array &inX1, const af::array &inX2, int q, af::array &outdK_dX)
Computes dK/dX.
NeuralEngine::MachineLearning::CompoundKernel::DiagGradParam
void DiagGradParam(const af::array &inX, const af::array &inCovDiag, af::array &outDiagdK_dParam)
Derivative of diagonal elemts of K w.r.t kernel parameters.
NeuralEngine::MachineLearning::CompoundKernel::SetParameters
void SetParameters(const af::array &param)
Sets the parameters.
NeuralEngine::MachineLearning::CompoundKernel::ComputeDiagonal
void ComputeDiagonal(const af::array &inX, af::array &outDiagonal)
Calculates only diagonal elements of K.
NeuralEngine::MachineLearning::CompoundKernel::AddKernel
void AddKernel(IKernel< Scalar > *kernel, af::array index)
Adds a kernel object and the corresponding column index of X for computation.
NeuralEngine::MachineLearning::CompoundKernel::LogLikGradientX
void LogLikGradientX(const af::array &inX, const af::array &indL_dK, af::array &outdL_dX)
Computes dL/dX for full fit GP.
NeuralEngine::MachineLearning::CompoundKernel::LogLikGradientParam
void LogLikGradientParam(const af::array &inX1, const af::array &inX2, const af::array &indL_dK, af::array &outdL_dParam)
Computes the gradient of the kernel parameters.
NeuralEngine::MachineLearning::CompoundKernel::ComputeKernelMatrix
void ComputeKernelMatrix(const af::array &inX1, const af::array &inX2, af::array &outMatrix)
Computes the kernel matrix of the kernel.
NeuralEngine::MachineLearning::IKernel
Definition: FgIKernel.h:36
NeuralEngine
Definition: NeArray2.h:18