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::SparseGPBaseLayer< Scalar > Class Template Reference

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

`#include <FgSparseGPBaseLayer.h>`

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

## Public Member Functions
| SparseGPBaseLayer (int numPoints, int numPseudos, int outputDim, int inputDim)
| Constructor. More...
virtual | ~SparseGPBaseLayer ()
| Destructor. More...
virtual void | ForwardPredictionPost (const af::array *mx, const af::array *vx, af::array &mout, af::array &vout) override
| Forward prediction of posterior function values. More...
virtual void | SampleFromPost (const af::array &inX, af::array &outfsample) override
| Samples from posterior. More...
void | ComputeKuu ()
| Calculates the kernel matrix of pseudo inputs. More...
void | ComputeKfu (const af::array &inX)
| Calculates the kernel matrix of inputes and pseudo inputs. More...
af::array | GetPseudoInputs ()
| Gets pseudo inputs. More...
virtual int | GetNumParameters () override
| Gets number of parameters to be optimized. More...
virtual void | SetParameters (const af::array &param) override
| Sets the parameters for each optimization iteration. More...
virtual af::array | GetParameters () override
| Gets the parameters for each optimization iteration. More...
virtual void | FixInducing (bool isfixed)
| Set fixation for inducing inputs. More...
virtual void | UpdateParameters () override
| Updates the parameters. More...
virtual void | InitParameters (af::array *X=nullptr) override
| Initializes the parameters. More...
Public Member Functions inherited from NeuralEngine::MachineLearning::GPModels::GPBaseLayer< Scalar >
| 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
| SparseGPBaseLayer ()
| Default constructor. More...
virtual void | ReinitParameters () override
| Reinitializes the parameters. More...
virtual void | ForwardPredictionDeterministicPost (const af::array &mx, af::array *mout, af::array *vout)
| Deterministic forward propagation through posterior. More...
virtual void | ForwardPredictionRandomPost (const af::array &mx, const af::array &vx, af::array &mout, af::array &vout, PropagationMode mode=PropagationMode::MomentMatching)
| Forward prediction through random posterior. More...
Protected Member Functions inherited from NeuralEngine::MachineLearning::GPModels::GPBaseLayer< Scalar >
| 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 | ik
af::array | afMu
af::array | afSu
af::array | afInvSu
af::array | afInvSuMu
af::array | T1
af::array | T2
af::array | T2_R
af::array | afXu
af::array | afKuu
af::array | afInvKuu
af::array | afKfu
bool | isFixedInducing
Protected Attributes inherited from NeuralEngine::MachineLearning::GPModels::GPBaseLayer< Scalar >
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::SparseGPBaseLayer< Scalar >

Abstract class for different GP likelihood layers.

, 27.02.2018.

Definition at line 34 of file FgSparseGPBaseLayer.h.

## Constructor & Destructor Documentation

## ◆ SparseGPBaseLayer() [1/2]

template<typename Scalar >

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

Constructor.

, 15.05.2018.

Parameters

  numPoints | Number of points.
  numPseudos | Number of pseudo inputs.
  outputDim | The output dimension.
  inputDim | The input dimension.

## ◆ ~SparseGPBaseLayer()

template<typename Scalar >

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

Destructor.

, 15.05.2018.

## ◆ SparseGPBaseLayer() [2/2]

template<typename Scalar >

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

Default constructor.

Hmetal T, 02/07/2018.

Definition at line 165 of file FgSparseGPBaseLayer.h.

## Member Function Documentation

## ◆ ForwardPredictionPost()

template<typename Scalar >

virtual void NeuralEngine::MachineLearning::GPModels::SparseGPBaseLayer< Scalar >::ForwardPredictionPost | ( | const af::array * | mx,
|  | const af::array * | vx,
|  | af::array & | mout,
|  | af::array & | vout
| ) |  |
| override 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 from NeuralEngine::MachineLearning::GPModels::GPBaseLayer< Scalar >.

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

## ◆ SampleFromPost()

template<typename Scalar >

virtual void NeuralEngine::MachineLearning::GPModels::SparseGPBaseLayer< Scalar >::SampleFromPost | ( | const af::array & | inX,
|  | af::array & | outfsample
| ) |  |
| override 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 from NeuralEngine::MachineLearning::GPModels::GPBaseLayer< Scalar >.

## ◆ ComputeKuu()

template<typename Scalar >

void NeuralEngine::MachineLearning::GPModels::SparseGPBaseLayer< Scalar >::ComputeKuu | ( |  | ) |

Calculates the kernel matrix of pseudo inputs.

, 15.05.2018.

## ◆ ComputeKfu()

template<typename Scalar >

void NeuralEngine::MachineLearning::GPModels::SparseGPBaseLayer< Scalar >::ComputeKfu | ( | const af::array & | inX | ) |

Calculates the kernel matrix of inputes and pseudo inputs.

, 15.05.2018.

## ◆ GetPseudoInputs()

template<typename Scalar >

af::array NeuralEngine::MachineLearning::GPModels::SparseGPBaseLayer< Scalar >::GetPseudoInputs | ( |  | ) |

Gets pseudo inputs.

Hmetal T, 17/06/2019.

Returns
  The pseudo inputs.

## ◆ GetNumParameters()

template<typename Scalar >

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

Gets number of parameters to be optimized.

, 26.06.2018.

Returns
  The number parameters.

Reimplemented from NeuralEngine::MachineLearning::GPModels::GPBaseLayer< Scalar >.

## ◆ SetParameters()

template<typename Scalar >

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

Sets the parameters for each optimization iteration.

, 26.06.2018.

Parameters

  param | The parameter.

Reimplemented from NeuralEngine::MachineLearning::GPModels::GPBaseLayer< Scalar >.

## ◆ GetParameters()

template<typename Scalar >

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

Gets the parameters for each optimization iteration.

, 26.06.2018.

Returns
  The parameters.

Reimplemented from NeuralEngine::MachineLearning::GPModels::GPBaseLayer< Scalar >.

## ◆ FixInducing()

template<typename Scalar >

virtual void NeuralEngine::MachineLearning::GPModels::SparseGPBaseLayer< Scalar >::FixInducing | ( | bool | isfixed | ) |
| virtual

Set fixation for inducing inputs.

Hmetal T, 16/12/2019.

Parameters

  isfixed | True if isfixed.

## ◆ UpdateParameters()

template<typename Scalar >

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

Updates the parameters.

, 26.06.2018.

Reimplemented from NeuralEngine::MachineLearning::GPModels::GPBaseLayer< Scalar >.

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

## ◆ InitParameters()

template<typename Scalar >

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

Initializes the parameters.

Hmetal T, 09/12/2019.

Parameters

  X | [in,out] (Optional) If non-null, an af::array to process.

Reimplemented from NeuralEngine::MachineLearning::GPModels::GPBaseLayer< Scalar >.

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

## ◆ ReinitParameters()

template<typename Scalar >

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

Reinitializes the parameters.

Hmetal T, 03/09/2020.

Reimplemented from NeuralEngine::MachineLearning::GPModels::GPBaseLayer< Scalar >.

## ◆ ForwardPredictionDeterministicPost()

template<typename Scalar >

virtual void NeuralEngine::MachineLearning::GPModels::SparseGPBaseLayer< Scalar >::ForwardPredictionDeterministicPost | ( | const af::array & | mx,
|  | af::array * | mout,
|  | af::array * | vout
| ) |  |
| protected virtual

Deterministic forward propagation through posterior.

Hmetal T, 01.04.2019.

Parameters

  mx | [in,out] The inputs mx.
  mout | [in,out] The m^{ }_{f}.
  vout | [in,out] The V^{ }_{ff}.

Reimplemented in NeuralEngine::MachineLearning::GPModels::AEP::SGPLayer< Scalar >.

## ◆ ForwardPredictionRandomPost()

template<typename Scalar >

virtual void NeuralEngine::MachineLearning::GPModels::SparseGPBaseLayer< Scalar >::ForwardPredictionRandomPost | ( | const af::array & | mx,
|  | const af::array & | vx,
|  | af::array & | mout,
|  | af::array & | vout,
|  | PropagationMode | mode = `PropagationMode::MomentMatching`
| ) |  |
| protected virtual

Forward prediction through random posterior.

, 16.05.2018.

Parameters

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

Reimplemented in NeuralEngine::MachineLearning::GPModels::AEP::SGPLayer< Scalar >.

## ◆ serialize()

template<typename Scalar >
template<class Archive >

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

Definition at line 221 of file FgSparseGPBaseLayer.h.

## Friends And Related Function Documentation

## ◆ boost::serialization::access

template<typename Scalar >

friend class boost::serialization::access
| friend

Definition at line 218 of file FgSparseGPBaseLayer.h.

## Member Data Documentation

## ◆ ik

template<typename Scalar >

int NeuralEngine::MachineLearning::GPModels::SparseGPBaseLayer< Scalar >::ik
| protected

Definition at line 198 of file FgSparseGPBaseLayer.h.

## ◆ afMu

template<typename Scalar >

af::array NeuralEngine::MachineLearning::GPModels::SparseGPBaseLayer< Scalar >::afMu
| protected

Definition at line 200 of file FgSparseGPBaseLayer.h.

## ◆ afSu

template<typename Scalar >

af::array NeuralEngine::MachineLearning::GPModels::SparseGPBaseLayer< Scalar >::afSu
| protected

Definition at line 201 of file FgSparseGPBaseLayer.h.

## ◆ afInvSu

template<typename Scalar >

af::array NeuralEngine::MachineLearning::GPModels::SparseGPBaseLayer< Scalar >::afInvSu
| protected

Definition at line 202 of file FgSparseGPBaseLayer.h.

## ◆ afInvSuMu

template<typename Scalar >

af::array NeuralEngine::MachineLearning::GPModels::SparseGPBaseLayer< Scalar >::afInvSuMu
| protected

Definition at line 203 of file FgSparseGPBaseLayer.h.

## ◆ T1

template<typename Scalar >

af::array NeuralEngine::MachineLearning::GPModels::SparseGPBaseLayer< Scalar >::T1
| protected

Definition at line 206 of file FgSparseGPBaseLayer.h.

## ◆ T2

template<typename Scalar >

af::array NeuralEngine::MachineLearning::GPModels::SparseGPBaseLayer< Scalar >::T2
| protected

Definition at line 207 of file FgSparseGPBaseLayer.h.

## ◆ T2_R

template<typename Scalar >

af::array NeuralEngine::MachineLearning::GPModels::SparseGPBaseLayer< Scalar >::T2_R
| protected

Definition at line 208 of file FgSparseGPBaseLayer.h.

## ◆ afXu

template<typename Scalar >

af::array NeuralEngine::MachineLearning::GPModels::SparseGPBaseLayer< Scalar >::afXu
| protected

Definition at line 210 of file FgSparseGPBaseLayer.h.

## ◆ afKuu

template<typename Scalar >

af::array NeuralEngine::MachineLearning::GPModels::SparseGPBaseLayer< Scalar >::afKuu
| protected

Definition at line 211 of file FgSparseGPBaseLayer.h.

## ◆ afInvKuu

template<typename Scalar >

af::array NeuralEngine::MachineLearning::GPModels::SparseGPBaseLayer< Scalar >::afInvKuu
| protected

Definition at line 212 of file FgSparseGPBaseLayer.h.

## ◆ afKfu

template<typename Scalar >

af::array NeuralEngine::MachineLearning::GPModels::SparseGPBaseLayer< Scalar >::afKfu
| protected

Definition at line 213 of file FgSparseGPBaseLayer.h.

## ◆ isFixedInducing

template<typename Scalar >

bool NeuralEngine::MachineLearning::GPModels::SparseGPBaseLayer< Scalar >::isFixedInducing
| protected

Definition at line 215 of file FgSparseGPBaseLayer.h.

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

- FgSparseGPBaseLayer.h