NeuralEngine
A Game Engine with embeded Machine Learning algorithms based on Gaussian Processes.
NeuralEngine::MachineLearning::IKernel< Scalar > Class Template Referenceabstract
Inheritance diagram for NeuralEngine::MachineLearning::IKernel< Scalar >:
Collaboration diagram for NeuralEngine::MachineLearning::IKernel< Scalar >:

Public Member Functions

 IKernel (KernelType type, int numParameters)
 Constructor. More...
 
virtual ~IKernel ()
 Destructor. More...
 
virtual int GetNumParameter ()
 Gets number of parametes of the kernel. More...
 
virtual KernelType GetKernelType ()
 Gets kernel type. More...
 
virtual void ComputeKernelMatrix (const af::array &inX1, const af::array &inX2, af::array &outMatrix)=0
 Computes the kernel matrix of the kernel. More...
 
virtual void ComputeDiagonal (const af::array &inX, af::array &outDiagonal)=0
 Calculates only diagonal elements of K. More...
 
virtual void LogLikGradientX (const af::array &inX, const af::array &indL_dK, af::array &outdL_dX)=0
 Computes dL/dX for full fit GP. More...
 
virtual 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)=0
 Computes dL / dX and dL / dXu for sparse approximation GP. More...
 
virtual void LogLikGradientX (const af::array &inX1, const af::array &inX2, const af::array &indL_dK, af::array &outdL_dX)
 Computes dL / dX for sparse approximation GP. More...
 
virtual void LogLikGradientParam (const af::array &inX1, const af::array &inX2, const af::array &indL_dK, af::array &outdL_dParam)=0
 Computes the gradient of LL w.r.t. the kernel parameters. More...
 
virtual void LogLikGradientParam (const af::array &inX1, const af::array &inX2, const af::array &indL_dK, af::array &outdL_dParam, const af::array *dlogZ_dv)
 Computes the gradient of LL w.r.t. the kernel parameters. More...
 
virtual void LogLikGradientCompundKfu (const af::array &indL_dKfu, const af::array &inX, const af::array &inXu, af::array *outdL_dParam, af::array *outdL_dXu, const af::array *dlogZ_dv=nullptr, af::array *outdL_dX=nullptr)
 
virtual void LogGradientCompoundKuu (const af::array &inXu, const af::array &inCovDiag, af::array *outdL_dParam, af::array *outdL_dXu)
 
virtual void GradX (const af::array &inX1, const af::array &inX2, int q, af::array &outdK_dX)=0
 Computes dK/dX. More...
 
virtual void DiagGradX (const af::array &inX, af::array &outDiagdK_dX)=0
 Derivative of diagonal elemts of K w.r.t X. More...
 
virtual void DiagGradParam (const af::array &inX, const af::array &inCovDiag, af::array &outDiagdK_dParam)=0
 Derivative of diagonal elemts of K w.r.t kernel parameters. More...
 
virtual void SetParameters (const af::array &param)=0
 Sets the parameters. More...
 
virtual void SetLogParameters (const af::array &param)
 Sets log parameters. More...
 
virtual af::array GetParameters ()=0
 Gets the parameters. More...
 
virtual af::array GetLogParameters ()
 Gets log parameters. More...
 
virtual void InitParameters (Scalar inMedian)
 
Initializes the parameters based on the median of the distances of /f$\mathbf{X}/f$. More...
 
virtual void ComputePsiStatistics (const af::array &inXu, const af::array &inMu, const af::array &inS, af::array &outPsi0, af::array &outPsi1, af::array &outPsi2)
 PSI statistics. More...
 
virtual void PsiDerivatives (const af::array &indL_dPsi0, const af::array &inPsi1, const af::array &indL_dPsi1, const af::array &inPsi2, const af::array &indL_dPsi2, const af::array &inXu, const af::array &inMu, const af::array &inS, af::array &outdL_dParam, af::array &outdL_dXu, af::array &outdL_dMu, af::array &outdL_dS, const af::array *dlogZ_dv=nullptr)
 Psi derivatives. More...
 

Protected Member Functions

 IKernel ()
 Default constructor. More...
 

Protected Attributes

KernelType eType
 
int iNumParam
 
af::dtype m_dType
 
Scalar sDegree
 
af::array afGHx
 
af::array afGHw
 
af::array afXs
 
bool bCacheK
 

Private Member Functions

template<class Archive >
void serialize (Archive &ar, unsigned int version)
 

Friends

class boost::serialization::access
 

Detailed Description

template<typename Scalar>
class NeuralEngine::MachineLearning::IKernel< Scalar >

Definition at line 35 of file FgIKernel.h.

Constructor & Destructor Documentation

◆ IKernel() [1/2]

template<typename Scalar >
NeuralEngine::MachineLearning::IKernel< Scalar >::IKernel ( KernelType  type,
int  numParameters 
)

Constructor.

Admin, 5/26/2017.

Parameters
typeThe type.
numParamNumber of parameters.

◆ ~IKernel()

template<typename Scalar >
virtual NeuralEngine::MachineLearning::IKernel< Scalar >::~IKernel ( )
virtual

Destructor.

Admin, 5/26/2017.

◆ IKernel() [2/2]

template<typename Scalar >
NeuralEngine::MachineLearning::IKernel< Scalar >::IKernel ( )
inlineprotected

Default constructor.

HmetalT, 02/07/2018.

Definition at line 304 of file FgIKernel.h.

Member Function Documentation

◆ GetNumParameter()

template<typename Scalar >
virtual int NeuralEngine::MachineLearning::IKernel< Scalar >::GetNumParameter ( )
virtual

Gets number of parametes of the kernel.

Admin, 5/24/2017.

Returns
The number parameter.

◆ GetKernelType()

template<typename Scalar >
virtual KernelType NeuralEngine::MachineLearning::IKernel< Scalar >::GetKernelType ( )
virtual

Gets kernel type.

Admin, 5/24/2017.

Returns
The kernel type.

◆ ComputeKernelMatrix()

template<typename Scalar >
virtual void NeuralEngine::MachineLearning::IKernel< Scalar >::ComputeKernelMatrix ( const af::array &  inX1,
const af::array &  inX2,
af::array &  outMatrix 
)
pure virtual

◆ ComputeDiagonal()

◆ LogLikGradientX() [1/3]

template<typename Scalar >
virtual void NeuralEngine::MachineLearning::IKernel< Scalar >::LogLikGradientX ( const af::array &  inX,
const af::array &  indL_dK,
af::array &  outdL_dX 
)
pure virtual

Computes dL/dX for full fit GP.

Admin, 5/23/2017.

Returns
The method returns the gradients of the latent points of type ILArray<double>.
Parameters
inX[in,out] Nxq Matrix of latent points.
indL_dK[in,out] Derivative of the loglikelihood w.r.t kernel matrix K.
outdL_dX[in,out] Derivative of the loglikelihood w.r.t latent points.

Implemented in NeuralEngine::MachineLearning::ARDKernel< Scalar >, NeuralEngine::MachineLearning::CompoundKernel< Scalar >, NeuralEngine::MachineLearning::InterDomainKernel< Scalar >, NeuralEngine::MachineLearning::LinearAccelerationKernel< Scalar >, NeuralEngine::MachineLearning::LinearKernel< Scalar >, NeuralEngine::MachineLearning::RBFAccelerationKernel< Scalar >, NeuralEngine::MachineLearning::RBFKernel< Scalar >, NeuralEngine::MachineLearning::StyleKernel< Scalar >, NeuralEngine::MachineLearning::TensorKernel< Scalar >, and NeuralEngine::MachineLearning::WhiteKernel< Scalar >.

◆ LogLikGradientX() [2/3]

template<typename Scalar >
virtual void NeuralEngine::MachineLearning::IKernel< Scalar >::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 
)
pure virtual

Computes dL / dX and dL / dXu for sparse approximation GP.

Admin, 5/23/2017.

Parameters
inXu[in,out] kxq Matrix of latent subset points.
indL_dKuu[in,out] Derivative of the loglikelihood w.r.t subset kernel matrix Kuu.
inX[in,out] Nxq Matrix of latent points.
indL_dKuf[in,out] Derivative of the loglikelihood w.r.t the kernel matrix K.
outdL_dXu[in,out] Derivative of the loglikelihood w.r.t latent subset points Xu.
outdL_dX[in,out] Derivative of the loglikelihood w.r.t latent points X.

Implemented in NeuralEngine::MachineLearning::ARDKernel< Scalar >, NeuralEngine::MachineLearning::CompoundKernel< Scalar >, NeuralEngine::MachineLearning::InterDomainKernel< Scalar >, NeuralEngine::MachineLearning::LinearAccelerationKernel< Scalar >, NeuralEngine::MachineLearning::LinearKernel< Scalar >, NeuralEngine::MachineLearning::RBFAccelerationKernel< Scalar >, NeuralEngine::MachineLearning::RBFKernel< Scalar >, NeuralEngine::MachineLearning::StyleKernel< Scalar >, NeuralEngine::MachineLearning::TensorKernel< Scalar >, and NeuralEngine::MachineLearning::WhiteKernel< Scalar >.

◆ LogLikGradientX() [3/3]

template<typename Scalar >
virtual void NeuralEngine::MachineLearning::IKernel< Scalar >::LogLikGradientX ( const af::array &  inX1,
const af::array &  inX2,
const af::array &  indL_dK,
af::array &  outdL_dX 
)
inlinevirtual

Computes dL / dX for sparse approximation GP.

Hmetal T, 25/11/2020.

Parameters
inX1The first latent points.
inX2The second latent points.
indL_dKThe derivative dL / dK.
outdL_dX[in,out] The derivative dL / dX.

Reimplemented in NeuralEngine::MachineLearning::ARDKernel< Scalar >, NeuralEngine::MachineLearning::InterDomainKernel< Scalar >, NeuralEngine::MachineLearning::LinearKernel< Scalar >, NeuralEngine::MachineLearning::StyleKernel< Scalar >, and NeuralEngine::MachineLearning::TensorKernel< Scalar >.

Definition at line 137 of file FgIKernel.h.

◆ LogLikGradientParam() [1/2]

template<typename Scalar >
virtual void NeuralEngine::MachineLearning::IKernel< Scalar >::LogLikGradientParam ( const af::array &  inX1,
const af::array &  inX2,
const af::array &  indL_dK,
af::array &  outdL_dParam 
)
pure virtual

◆ LogLikGradientParam() [2/2]

template<typename Scalar >
virtual void NeuralEngine::MachineLearning::IKernel< Scalar >::LogLikGradientParam ( const af::array &  inX1,
const af::array &  inX2,
const af::array &  indL_dK,
af::array &  outdL_dParam,
const af::array *  dlogZ_dv 
)
inlinevirtual

Computes the gradient of LL w.r.t. the kernel parameters.

Admin, 5/23/2017.

Parameters
indL_dK[in,out] Derivative of the loglikelihood w.r.t the kernel matrix K.
outdL_dParam[in,out] Gradient of kernel parameters.

Reimplemented in NeuralEngine::MachineLearning::ARDKernel< Scalar >, NeuralEngine::MachineLearning::InterDomainKernel< Scalar >, NeuralEngine::MachineLearning::LinearKernel< Scalar >, NeuralEngine::MachineLearning::StyleKernel< Scalar >, and NeuralEngine::MachineLearning::TensorKernel< Scalar >.

Definition at line 161 of file FgIKernel.h.

◆ LogLikGradientCompundKfu()

template<typename Scalar >
virtual void NeuralEngine::MachineLearning::IKernel< Scalar >::LogLikGradientCompundKfu ( const af::array &  indL_dKfu,
const af::array &  inX,
const af::array &  inXu,
af::array *  outdL_dParam,
af::array *  outdL_dXu,
const af::array *  dlogZ_dv = nullptr,
af::array *  outdL_dX = nullptr 
)
inlinevirtual

Definition at line 163 of file FgIKernel.h.

◆ LogGradientCompoundKuu()

template<typename Scalar >
virtual void NeuralEngine::MachineLearning::IKernel< Scalar >::LogGradientCompoundKuu ( const af::array &  inXu,
const af::array &  inCovDiag,
af::array *  outdL_dParam,
af::array *  outdL_dXu 
)
inlinevirtual

Definition at line 166 of file FgIKernel.h.

◆ GradX()

template<typename Scalar >
virtual void NeuralEngine::MachineLearning::IKernel< Scalar >::GradX ( const af::array &  inX1,
const af::array &  inX2,
int  q,
af::array &  outdK_dX 
)
pure virtual

◆ DiagGradX()

◆ DiagGradParam()

template<typename Scalar >
virtual void NeuralEngine::MachineLearning::IKernel< Scalar >::DiagGradParam ( const af::array &  inX,
const af::array &  inCovDiag,
af::array &  outDiagdK_dParam 
)
pure virtual

◆ SetParameters()

◆ SetLogParameters()

◆ GetParameters()

◆ GetLogParameters()

◆ InitParameters()

template<typename Scalar >
virtual void NeuralEngine::MachineLearning::IKernel< Scalar >::InitParameters ( Scalar  inMedian)
inlinevirtual


Initializes the parameters based on the median of the distances of /f$\mathbf{X}/f$.

Hmetal T, 06/11/2020.

Parameters
inMedianThe in median.

Reimplemented in NeuralEngine::MachineLearning::ARDKernel< Scalar >, NeuralEngine::MachineLearning::InterDomainKernel< Scalar >, NeuralEngine::MachineLearning::LinearKernel< Scalar >, NeuralEngine::MachineLearning::StyleKernel< Scalar >, and NeuralEngine::MachineLearning::TensorKernel< Scalar >.

Definition at line 248 of file FgIKernel.h.

◆ ComputePsiStatistics()

template<typename Scalar >
virtual void NeuralEngine::MachineLearning::IKernel< Scalar >::ComputePsiStatistics ( const af::array &  inXu,
const af::array &  inMu,
const af::array &  inS,
af::array &  outPsi0,
af::array &  outPsi1,
af::array &  outPsi2 
)
virtual

PSI statistics.

PSI statistics computation.


An approximated psi-statistics based on Gauss-Hermite Quadrature

HmetalT, 15/07/2019.

Parameters
inZLog normalizer.
inMuPosterior mean.
inSPosterior covariance.
outPsi0[in,out] Psi0.
outPsi1[in,out] Psi1.
outPsi2[in,out] Psi2.

Reimplemented in NeuralEngine::MachineLearning::ARDKernel< Scalar >, NeuralEngine::MachineLearning::InterDomainKernel< Scalar >, NeuralEngine::MachineLearning::LinearKernel< Scalar >, and NeuralEngine::MachineLearning::TensorKernel< Scalar >.

◆ PsiDerivatives()

template<typename Scalar >
virtual void NeuralEngine::MachineLearning::IKernel< Scalar >::PsiDerivatives ( const af::array &  indL_dPsi0,
const af::array &  inPsi1,
const af::array &  indL_dPsi1,
const af::array &  inPsi2,
const af::array &  indL_dPsi2,
const af::array &  inXu,
const af::array &  inMu,
const af::array &  inS,
af::array &  outdL_dParam,
af::array &  outdL_dXu,
af::array &  outdL_dMu,
af::array &  outdL_dS,
const af::array *  dlogZ_dv = nullptr 
)
virtual

Psi derivatives.

Hmetal T, 10/11/2020.

Parameters
inPsi1The first in psi.
indL_dPsi1The first ind l d psi.
inPsi2The second in psi.
indL_dPsi2The second ind l d psi.
inXuThe in xu.
inMuThe in mu.
inSThe in s.
outdL_dParam[in,out] The outd l d parameter.
outdL_dXu[in,out] The outd l d xu.
outdL_dMu[in,out] The outd l d mu.
outdL_dS[in,out] The outd l d s.
dlogZ_dv(Optional) The dlog z coordinate dv.

Reimplemented in NeuralEngine::MachineLearning::ARDKernel< Scalar >, NeuralEngine::MachineLearning::InterDomainKernel< Scalar >, NeuralEngine::MachineLearning::LinearKernel< Scalar >, and NeuralEngine::MachineLearning::TensorKernel< Scalar >.

◆ serialize()

template<typename Scalar >
template<class Archive >
void NeuralEngine::MachineLearning::IKernel< Scalar >::serialize ( Archive &  ar,
unsigned int  version 
)
inlineprivate

Definition at line 322 of file FgIKernel.h.

Friends And Related Function Documentation

◆ boost::serialization::access

template<typename Scalar >
friend class boost::serialization::access
friend

Definition at line 319 of file FgIKernel.h.

Member Data Documentation

◆ eType

template<typename Scalar >
KernelType NeuralEngine::MachineLearning::IKernel< Scalar >::eType
protected

Definition at line 306 of file FgIKernel.h.

◆ iNumParam

template<typename Scalar >
int NeuralEngine::MachineLearning::IKernel< Scalar >::iNumParam
protected

Definition at line 307 of file FgIKernel.h.

◆ m_dType

template<typename Scalar >
af::dtype NeuralEngine::MachineLearning::IKernel< Scalar >::m_dType
protected

Definition at line 309 of file FgIKernel.h.

◆ sDegree

template<typename Scalar >
Scalar NeuralEngine::MachineLearning::IKernel< Scalar >::sDegree
protected

Definition at line 312 of file FgIKernel.h.

◆ afGHx

template<typename Scalar >
af::array NeuralEngine::MachineLearning::IKernel< Scalar >::afGHx
protected

Definition at line 313 of file FgIKernel.h.

◆ afGHw

template<typename Scalar >
af::array NeuralEngine::MachineLearning::IKernel< Scalar >::afGHw
protected

Definition at line 314 of file FgIKernel.h.

◆ afXs

template<typename Scalar >
af::array NeuralEngine::MachineLearning::IKernel< Scalar >::afXs
protected

Definition at line 315 of file FgIKernel.h.

◆ bCacheK

template<typename Scalar >
bool NeuralEngine::MachineLearning::IKernel< Scalar >::bCacheK
protected

Definition at line 316 of file FgIKernel.h.


The documentation for this class was generated from the following file: