NeuralEngine
A Game Engine with embeded Machine Learning algorithms based on Gaussian Processes.
NeuralEngine::MachineLearning::GPModels::KBR< Scalar > Class Template Reference


Back-constraints via kernel based regression.
More...

#include <FgKernelBasedRegression.h>

Inheritance diagram for NeuralEngine::MachineLearning::GPModels::KBR< Scalar >:
Collaboration diagram for NeuralEngine::MachineLearning::GPModels::KBR< Scalar >:

Public Member Functions

 KBR ()
 Default constructor. More...
 
virtual ~KBR ()
 Destructor. More...
 
virtual void Init (const af::array &Y, const af::array &X, const af::array &segments)
 Initializes this object. More...
 
virtual int GetNumParameters ()
 Gets number of to be optimized parameters. More...
 
virtual void SetParameters (const af::array &param)
 Sets the parameters. More...
 
virtual af::array GetParameters ()
 Gets the parameters. More...
 
virtual af::array GetConstraintX ()
 Gets constraint x coordinates. More...
 
virtual af::array BackconstraintGradient (const af::array &gX)
 Back-constraint gradient. More...
 
virtual void SetKernel (IKernel< Scalar > *inKernel)
 Sets a kernel function. More...
 
virtual IKernel< Scalar > * GetKernel ()
 Gets the kernel function. More...
 
- Public Member Functions inherited from NeuralEngine::MachineLearning::GPModels::IBackconstraint< Scalar >
 IBackconstraint (BackConstType type)
 Constructor. More...
 
virtual ~IBackconstraint ()
 Destructor. More...
 
virtual void Init (const af::array &Y, const af::array &X, const af::array &segments)=0
 Initializes this object. More...
 
virtual int GetNumParameters ()=0
 Gets number of to be optimized parameters. More...
 
virtual void SetParameters (const af::array &param)=0
 Sets the parameters. More...
 
virtual af::array GetParameters ()=0
 Gets the parameters. More...
 
virtual af::array GetConstraintX ()=0
 Gets constraint x coordinates. More...
 
virtual af::array BackconstraintGradient (const af::array &gX)=0
 Back-constraint gradient. More...
 
BackConstType GetType ()
 Gets the back-constraint type. More...
 

Protected Attributes

af::array afA
 parameters More...
 
af::array afK
 kernel matrix More...
 
IKernel< Scalar > * kernel
 kernel function More...
 
- Protected Attributes inherited from NeuralEngine::MachineLearning::GPModels::IBackconstraint< Scalar >
int iN
 dataset length More...
 
int iq
 latent dimension More...
 
af::dtype m_dType
 floating point precision flag for af::array More...
 

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::GPModels::KBR< Scalar >


Back-constraints via kernel based regression.


Rather than maximising the likelihood with respect to \(\mathbf{X}\) directly, we replace each element of \(\mathbf{X}\) with a mapping of the form:

\[ x_{nj} = g_j(\mathbf{y}_n;\mathbf{w}). \]

Two points in latent space will then be constrained to always be close if their data space counterparts are close. Instead of direct likelihood maximization, we now maximize a constrained likelihood, the constraints preserving nearby ‘localities’. How close is 'nearby' is determined by the smoothness of the mapping. For example we use for the mapping an RBF kernel,

\[ g_j(\mathbf{y}_n) = \sum_{m=1}^N \alpha_{jm} k(\mathbf{y}_n, \mathbf{y}_m), \]

where \(\mathbf{A} = \{\{\alpha_{jn}\}_{n=1}^N\}_{j=1}^q \) are the parameters, and the kernel matrix is,

\[ k(\mathbf{y}_n, \mathbf{y}_m) = \exp\left(-\frac{\gamma}{2}(\mathbf{y}_n − \mathbf{y}_m)^T(\mathbf{y}_n − \mathbf{y}_m)\right), \]

closeness is determined by the setting of the inverse width parameter \(\gamma\).

Reference:

HmetalT, 26.10.2017.

Definition at line 67 of file FgKernelBasedRegression.h.

Constructor & Destructor Documentation

◆ KBR()

Default constructor.

Hmetal T, 17/09/2020.

◆ ~KBR()

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

Destructor.

Hmetal T, 17/09/2020.

Member Function Documentation

◆ Init()

template<typename Scalar >
virtual void NeuralEngine::MachineLearning::GPModels::KBR< Scalar >::Init ( const af::array &  Y,
const af::array &  X,
const af::array &  segments 
)
virtual

Initializes this object.

Hmetal T, 17/09/2020.

Parameters
YAn af::array to process.
XAn af::array to process.

Implements NeuralEngine::MachineLearning::GPModels::IBackconstraint< Scalar >.

◆ GetNumParameters()

template<typename Scalar >
virtual int NeuralEngine::MachineLearning::GPModels::KBR< Scalar >::GetNumParameters ( )
virtual

Gets number of to be optimized parameters.

Hmetal T, 17/09/2020.

Returns
The number parameters.

Implements NeuralEngine::MachineLearning::GPModels::IBackconstraint< Scalar >.

◆ SetParameters()

template<typename Scalar >
virtual void NeuralEngine::MachineLearning::GPModels::KBR< Scalar >::SetParameters ( const af::array &  param)
virtual

Sets the parameters.

Hmetal T, 17/09/2020.

Parameters
paramThe parameter.

Implements NeuralEngine::MachineLearning::GPModels::IBackconstraint< Scalar >.

◆ GetParameters()

template<typename Scalar >
virtual af::array NeuralEngine::MachineLearning::GPModels::KBR< Scalar >::GetParameters ( )
virtual

Gets the parameters.

Hmetal T, 17/09/2020.

Returns
The parameters.

Implements NeuralEngine::MachineLearning::GPModels::IBackconstraint< Scalar >.

◆ GetConstraintX()

template<typename Scalar >
virtual af::array NeuralEngine::MachineLearning::GPModels::KBR< Scalar >::GetConstraintX ( )
virtual

Gets constraint x coordinates.

Hmetal T, 17/09/2020.

Returns
The constraint x coordinate.

Implements NeuralEngine::MachineLearning::GPModels::IBackconstraint< Scalar >.

◆ BackconstraintGradient()

template<typename Scalar >
virtual af::array NeuralEngine::MachineLearning::GPModels::KBR< Scalar >::BackconstraintGradient ( const af::array &  gX)
virtual

Back-constraint gradient.

Hmetal T, 17/09/2020.

Parameters
gXThe gradient of \(\mathbf{X}\).
Returns
The gradient of the back-constraint.

Implements NeuralEngine::MachineLearning::GPModels::IBackconstraint< Scalar >.

◆ SetKernel()

template<typename Scalar >
virtual void NeuralEngine::MachineLearning::GPModels::KBR< Scalar >::SetKernel ( IKernel< Scalar > *  inKernel)
virtual

Sets a kernel function.

Hmetal T, 17/09/2020.

Parameters
inKernel[in,out] If non-null, the in kernel.

◆ GetKernel()

template<typename Scalar >
virtual IKernel< Scalar > * NeuralEngine::MachineLearning::GPModels::KBR< Scalar >::GetKernel ( )
virtual

Gets the kernel function.

Hmetal T, 17/09/2020.

Returns
Null if it fails, else the kernel.

◆ serialize()

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

Definition at line 170 of file FgKernelBasedRegression.h.

Friends And Related Function Documentation

◆ boost::serialization::access

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

Definition at line 167 of file FgKernelBasedRegression.h.

Member Data Documentation

◆ afA

template<typename Scalar >
af::array NeuralEngine::MachineLearning::GPModels::KBR< Scalar >::afA
protected

parameters

Definition at line 162 of file FgKernelBasedRegression.h.

◆ afK

template<typename Scalar >
af::array NeuralEngine::MachineLearning::GPModels::KBR< Scalar >::afK
protected

kernel matrix

Definition at line 163 of file FgKernelBasedRegression.h.

◆ kernel

template<typename Scalar >
IKernel<Scalar>* NeuralEngine::MachineLearning::GPModels::KBR< Scalar >::kernel
protected

kernel function

Definition at line 164 of file FgKernelBasedRegression.h.


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