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

Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Friends | List of all members
NeuralEngine::MachineLearning::GPModels::GPBaseLayer< Scalar > Class Template Reference

Abstract class for different GP likelihood layers. More...

`#include <FgGPBaseLayer.h>`

Inheritance diagram for NeuralEngine::MachineLearning::GPModels::GPBaseLayer< Scalar >:
[legend]
Collaboration diagram for NeuralEngine::MachineLearning::GPModels::GPBaseLayer< Scalar >:
[legend]

## Public Member Functions
| GPBaseLayer (int numPoints, int outputDim, int inputDim)
| Constructor. More...
virtual | ~GPBaseLayer ()
| Destructor. More...
IKernel< Scalar > * | GetKernel ()
| Gets the kernel function. More...
void | SetKernel (IKernel< Scalar > *kern)
| Sets a kernel function. More...
virtual void | InitParameters (af::array *X=nullptr)
virtual int | GetNumParameters ()
| Gets number of parameters to be optimized. More...
virtual void | SetParameters (const af::array &param)
| Sets the parameters for each optimization iteration. More...
virtual af::array | GetParameters ()
| Gets the parameters for each optimization iteration. More...
virtual void | ForwardPredictionPost (const af::array *mx, const af::array *vx, af::array &mout, af::array &vout)
| Forward prediction of posterior function values. More...
virtual void | SampleFromPost (const af::array &inX, af::array &outfsample)
| Samples from posterior. More...
virtual void | FixKernelParameters (bool isfixed)
| Sets fixation for hyperparameters. More...
virtual void | UpdateParameters ()
| Updates the parameters. More...
virtual void | SetDataSize (int length, int dimension) override
| Sets data size. More...
void | SetStyles (std::map< std::string, Style< Scalar > > *styles)
| Sets the syles. More...
void | SetLatentDimension (int q)
| Sets latent dimension. More...
Public Member Functions inherited from NeuralEngine::MachineLearning::ILayer< Scalar >
| ILayer (LayerType type, int numPoints, int outputDim)
| Constructor. More...
virtual | ~ILayer ()=default
| Destructor. More...
LayerType | GetType ()
| Gets the layer type. More...
virtual int | GetNumParameters ()=0
| Gets number of parameters to be optimized. More...
virtual void | SetParameters (const af::array &param)=0
| Sets the parameters for each optimization iteration. More...
virtual af::array | GetParameters ()=0
| Gets the parameters for each optimization iteration. More...
virtual void | UpdateParameters ()=0
| Updates the parameters. More...
virtual void | SetDataSize (int length, int dimension)
| Sets data size. More...

## Protected Member Functions
| GPBaseLayer ()
| Default constructor. More...
virtual void | ReinitParameters ()
| Reinitializes the parameters. More...
Protected Member Functions inherited from NeuralEngine::MachineLearning::ILayer< Scalar >
| ILayer ()
| Default constructor. More...

## Protected Attributes
int | iq
| Latent dimension. More...
bool | isFixedHypers
IKernel< Scalar > * | kernel
| kernel function More...
std::map< std::string, Style< Scalar > > * | mStyles
| style variable More...
Scalar | JITTER
| for kernel matrix stability (positive definiteness) More...
Protected Attributes inherited from NeuralEngine::MachineLearning::ILayer< Scalar >
int | iD
| data dimension More...
int | iN
| data size More...
LayerType | lType
| liklihood or gp layer 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::GPBaseLayer< Scalar >

Abstract class for different GP likelihood layers.

, 27.02.2018.

Definition at line 29 of file FgGPBaseLayer.h.

## Constructor & Destructor Documentation

## ◆ GPBaseLayer() [1/2]

template<typename Scalar >

NeuralEngine::MachineLearning::GPModels::GPBaseLayer< Scalar >::GPBaseLayer | ( | int | numPoints,
|  | int | outputDim,
|  | int | inputDim
| ) |  |

Constructor.

, 26.04.2018.

Parameters

  numPoints | Number of training points.
  outputDim | The output dimension.
  inputDim | The input dimension.

## ◆ ~GPBaseLayer()

template<typename Scalar >

virtual NeuralEngine::MachineLearning::GPModels::GPBaseLayer< Scalar >::~GPBaseLayer | ( |  | ) |
| virtual

Destructor.

, 26.04.2018.

## ◆ GPBaseLayer() [2/2]

template<typename Scalar >

NeuralEngine::MachineLearning::GPModels::GPBaseLayer< Scalar >::GPBaseLayer | ( |  | ) |
| inline protected

Default constructor.

Hmetal T, 02/07/2018.

Definition at line 174 of file FgGPBaseLayer.h.

## Member Function Documentation

## ◆ GetKernel()

template<typename Scalar >

IKernel< Scalar > * NeuralEngine::MachineLearning::GPModels::GPBaseLayer< Scalar >::GetKernel | ( |  | ) |

Gets the kernel function.

, 26.04.2018.

Returns
  null if it fails, else the kernel.

## ◆ SetKernel()

template<typename Scalar >

void NeuralEngine::MachineLearning::GPModels::GPBaseLayer< Scalar >::SetKernel | ( | IKernel< Scalar > * | kern | ) |

Sets a kernel function.

, 26.04.2018.

Parameters

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

## ◆ InitParameters()

template<typename Scalar >

virtual void NeuralEngine::MachineLearning::GPModels::GPBaseLayer< Scalar >::InitParameters | ( | af::array * | X = `nullptr` | ) |
| virtual

Reimplemented in NeuralEngine::MachineLearning::GPModels::PowerEP::SGPLayer< Scalar >, NeuralEngine::MachineLearning::GPModels::PowerEP::SGPLayer2nd< Scalar >, and NeuralEngine::MachineLearning::GPModels::SparseGPBaseLayer< Scalar >.

## ◆ GetNumParameters()

template<typename Scalar >

virtual int NeuralEngine::MachineLearning::GPModels::GPBaseLayer< Scalar >::GetNumParameters | ( |  | ) |
| virtual

Gets number of parameters to be optimized.

, 26.06.2018.

Returns
  The number parameters.

Implements NeuralEngine::MachineLearning::ILayer< Scalar >.

Reimplemented in NeuralEngine::MachineLearning::GPModels::SparseGPBaseLayer< Scalar >.

## ◆ SetParameters()

template<typename Scalar >

virtual void NeuralEngine::MachineLearning::GPModels::GPBaseLayer< Scalar >::SetParameters | ( | const af::array & | param | ) |
| virtual

Sets the parameters for each optimization iteration.

, 26.06.2018.

Parameters

  param | The parameter.

Implements NeuralEngine::MachineLearning::ILayer< Scalar >.

Reimplemented in NeuralEngine::MachineLearning::GPModels::SparseGPBaseLayer< Scalar >.

## ◆ GetParameters()

template<typename Scalar >

virtual af::array NeuralEngine::MachineLearning::GPModels::GPBaseLayer< Scalar >::GetParameters | ( |  | ) |
| virtual

Gets the parameters for each optimization iteration.

, 26.06.2018.

Returns
  The parameters.

Implements NeuralEngine::MachineLearning::ILayer< Scalar >.

Reimplemented in NeuralEngine::MachineLearning::GPModels::SparseGPBaseLayer< Scalar >.

## ◆ ForwardPredictionPost()

template<typename Scalar >

virtual void NeuralEngine::MachineLearning::GPModels::GPBaseLayer< Scalar >::ForwardPredictionPost | ( | const af::array * | mx,
|  | const af::array * | vx,
|  | af::array & | mout,
|  | af::array & | vout
| ) |  |
| virtual

Forward prediction of posterior function values.

, 12.06.2018.

Parameters

  mout | [in,out] The m^{ }_{f}.
  vout | [in,out] The V^{ }_{ff}.
  mx | [in,out] The inputs mx.
  vx | [in,out] (Optional) If non-null, the variances vx.

Reimplemented in NeuralEngine::MachineLearning::GPModels::PowerEP::SGPLayer2nd< Scalar >, and NeuralEngine::MachineLearning::GPModels::SparseGPBaseLayer< Scalar >.

## ◆ SampleFromPost()

template<typename Scalar >

virtual void NeuralEngine::MachineLearning::GPModels::GPBaseLayer< Scalar >::SampleFromPost | ( | const af::array & | inX,
|  | af::array & | outfsample
| ) |  |
| virtual

Samples from posterior.

, 12.06.2018.

Parameters

  vx | [in,out] (Optional) If non-null, the variances vx.

Parameters

  mx | [in,out] The inputs mx.

Parameters

  fsample | [in,out] The m^{ }_{f}.
  inX | The V^{ }_{ff}.

Reimplemented in NeuralEngine::MachineLearning::GPModels::SparseGPBaseLayer< Scalar >.

## ◆ FixKernelParameters()

template<typename Scalar >

virtual void NeuralEngine::MachineLearning::GPModels::GPBaseLayer< Scalar >::FixKernelParameters | ( | bool | isfixed | ) |
| virtual

Sets fixation for hyperparameters.

Hmetal T, 16/12/2019.

Parameters

  isfixed | True if isfixed.

## ◆ UpdateParameters()

template<typename Scalar >

virtual void NeuralEngine::MachineLearning::GPModels::GPBaseLayer< Scalar >::UpdateParameters | ( |  | ) |
| virtual

Updates the parameters.

, 26.06.2018.

Implements NeuralEngine::MachineLearning::ILayer< Scalar >.

Reimplemented in NeuralEngine::MachineLearning::GPModels::AEP::SGPLayer< Scalar >, NeuralEngine::MachineLearning::GPModels::PowerEP::SGPLayer< Scalar >, NeuralEngine::MachineLearning::GPModels::PowerEP::SGPLayer2nd< Scalar >, and NeuralEngine::MachineLearning::GPModels::SparseGPBaseLayer< Scalar >.

## ◆ SetDataSize()

template<typename Scalar >

virtual void NeuralEngine::MachineLearning::GPModels::GPBaseLayer< Scalar >::SetDataSize | ( | int | length,
|  | int | dimension
| ) |  |
| override virtual

Sets data size.

Hmetal T, 03/09/2020.

Parameters

  length | The length.
  dimension | The dimension.

Reimplemented from NeuralEngine::MachineLearning::ILayer< Scalar >.

## ◆ SetStyles()

template<typename Scalar >

void NeuralEngine::MachineLearning::GPModels::GPBaseLayer< Scalar >::SetStyles | ( | std::map< std::string, Style< Scalar > > * | styles | ) |

Sets the syles.

Hmetal T, 25/09/2020.

Parameters

  styles | [in,out] If non-null, the styles.

## ◆ SetLatentDimension()

template<typename Scalar >

void NeuralEngine::MachineLearning::GPModels::GPBaseLayer< Scalar >::SetLatentDimension | ( | int | q | ) |

Sets latent dimension.

Hmetal T, 28/06/2022.

Parameters

  q | An int to process.

## ◆ ReinitParameters()

template<typename Scalar >

virtual void NeuralEngine::MachineLearning::GPModels::GPBaseLayer< Scalar >::ReinitParameters | ( |  | ) |
| protected virtual

Reinitializes the parameters.

Hmetal T, 03/09/2020.

Reimplemented in NeuralEngine::MachineLearning::GPModels::SparseGPBaseLayer< Scalar >.

## ◆ serialize()

template<typename Scalar >
template<class Archive >

void NeuralEngine::MachineLearning::GPModels::GPBaseLayer< Scalar >::serialize | ( | Archive & | ar,
|  | unsigned int | version
| ) |  |
| inline private

Definition at line 196 of file FgGPBaseLayer.h.

## Friends And Related Function Documentation

## ◆ boost::serialization::access

template<typename Scalar >

friend class boost::serialization::access
| friend

Definition at line 193 of file FgGPBaseLayer.h.

## Member Data Documentation

## ◆ iq

template<typename Scalar >

int NeuralEngine::MachineLearning::GPModels::GPBaseLayer< Scalar >::iq
| protected

Latent dimension.

Definition at line 183 of file FgGPBaseLayer.h.

## ◆ isFixedHypers

template<typename Scalar >

bool NeuralEngine::MachineLearning::GPModels::GPBaseLayer< Scalar >::isFixedHypers
| protected

Definition at line 185 of file FgGPBaseLayer.h.

## ◆ kernel

template<typename Scalar >

IKernel<Scalar>* NeuralEngine::MachineLearning::GPModels::GPBaseLayer< Scalar >::kernel
| protected

kernel function

Definition at line 187 of file FgGPBaseLayer.h.

## ◆ mStyles

template<typename Scalar >

std::map<std::string, Style<Scalar> >* NeuralEngine::MachineLearning::GPModels::GPBaseLayer< Scalar >::mStyles
| protected

style variable

Definition at line 188 of file FgGPBaseLayer.h.

## ◆ JITTER

template<typename Scalar >

Scalar NeuralEngine::MachineLearning::GPModels::GPBaseLayer< Scalar >::JITTER
| protected

for kernel matrix stability (positive definiteness)

Definition at line 190 of file FgGPBaseLayer.h.

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

- FgGPBaseLayer.h