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

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

Likelihood emission layer for State Space Models based on Gaussian distribution. More...

`#include <FgGaussEmissionLayer.h>`

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

## Public Member Functions
| GaussEmission (const af::array &y, int outputDim, int inputDim)
| Constructor. More...
virtual | ~GaussEmission ()
| Destructor. More...
virtual void | ProbabilisticOutput (const af::array &mf, const af::array &vf, af::array &myOut, af::array &vyOut, Scalar alpha=1.0f)
| Probabilistic output. More...
virtual Scalar | ComputeLogZEmission (const af::array &mx, const af::array &vx, const af::array &y, const Scalar scale, std::map< std::string, af::array > *outGradInput, af::array &outHyperGrad, Scalar alpha=1.0)
| Calculates tilted distribution and its gradients. More...
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 | UpdateParameters ()
| Updates the parameters. More...
virtual void | InitParameters ()
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 Attributes
af::array | afY
| Default constructor. More...
af::array | afU
af::array | afR
int | iq
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

## Additional Inherited Members
Protected Member Functions inherited from NeuralEngine::MachineLearning::ILayer< Scalar >
| ILayer ()
| Default constructor. More...

## Detailed Description

template<typename Scalar>
class NeuralEngine::MachineLearning::GPModels::GaussEmission< Scalar >

Likelihood emission layer for State Space Models based on Gaussian distribution.

We assume that the emission likelihood takes a Gaussian form,

\[ p(\mathbf{y}_t|\mathbf{x}_t) = \mathcal{N}(\mathbf{y}_t;\mathbf{Ux}_t,\mathbf{R_y}),\]

and that the approximate factor \(\mathbf{γ}_t(\mathbf{x}_t)\) is also a Gaussian over \(\mathbf{x}_t\). As such, it is straightforward to show that in the Gaussian case, the parameters for \(\mathbf{\gamma}_t(\mathbf{x}_t)\) are identical to that of \(p(\mathbf{y}_t|\mathbf{x}_t)\), when \(p(\mathbf{y}_t|\mathbf{x}_t)\) is viewed as a Gaussian over \(\mathbf{x}_t\),

\[ \mathbf{\gamma}_t(\mathbf{x}_t)\propto \exp(−\frac{1}{2}\mathbf{x}_t\mathbf{U}^T\mathbf{R_y}\mathbf{Ux}^T_t+\mathbf{x}_t\mathbf{U}^T\mathbf{R_y}\mathbf{y}).\]

Note that this optimal form does not depend on the power parameter of Power EP, \(\alpha\). However,the log-normaliser of the tilted distribution and hence the contribution of the emission likelihood towards the approximate marginal likelihood does depend on \(\alpha\), as follows,

\[ \tilde{Z}=\int d\mathbf{x}_t q^{\backslash t}(\mathbf{x}_t) p^{\alpha}(\mathbf{y}_t|\mathbf{x}_t) =\frac{(2\pi)^{D_y/2}|\alpha^{−1}\mathbf{R_y}|}{(2\pi)^{\alpha D_y/2}|\mathbf{R_y}|^{\alpha}} \mathcal{N}(\mathbf{y}_t;\mathbf{Um}^{\backslash t}_{\mathbf{x}_t};\mathbf{US}^{\backslash t}_{\mathbf{x}_t}\mathbf{U}^T+\alpha^{−1}\mathbf{R_y}).\]

References:

- Bui, T. D. (2018). Efficient Deterministic Approximate Bayesian Inference for Gaussian Process models (Doctoral thesis). https://doi.org/10.17863/CAM.20913

HmetalT, 04/05/2022.

Definition at line 66 of file FgGaussEmissionLayer.h.

## Constructor & Destructor Documentation

## ◆ GaussEmission()

template<typename Scalar >

NeuralEngine::MachineLearning::GPModels::GaussEmission< Scalar >::GaussEmission | ( | const af::array & | y,
|  | int | outputDim,
|  | int | inputDim
| ) |  |

Constructor.

, 26.06.2018.

Parameters

  y | data array.
  outputDim | The output dim.
  inputDim | The input dim.

## ◆ ~GaussEmission()

template<typename Scalar >

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

Destructor.

, 26.06.2018.

## Member Function Documentation

## ◆ ProbabilisticOutput()

template<typename Scalar >

virtual void NeuralEngine::MachineLearning::GPModels::GaussEmission< Scalar >::ProbabilisticOutput | ( | const af::array & | mf,
|  | const af::array & | vf,
|  | af::array & | myOut,
|  | af::array & | vyOut,
|  | Scalar | alpha = `1.0f`
| ) |  |
| virtual

Probabilistic output.

Hmetal T, 22/04/2022.

Parameters

  mf | The noiseless mean.
  vf | The noiseless variance.
  myOut | [in,out] my out.
  vyOut | [in,out] The vy out.
  alpha | (Optional) The alpha.

## ◆ ComputeLogZEmission()

template<typename Scalar >

virtual Scalar NeuralEngine::MachineLearning::GPModels::GaussEmission< Scalar >::ComputeLogZEmission | ( | const af::array & | mx,
|  | const af::array & | vx,
|  | const af::array & | y,
|  | const Scalar | scale,
|  | std::map< std::string, af::array > * | outGradInput,
|  | af::array & | outHyperGrad,
|  | Scalar | alpha = `1.0`
| ) |  |
| virtual

Calculates tilted distribution and its gradients.

Hmetal T, 06/04/2022.

Parameters

  mx | Cavity mean.
  vx | Cavity variance.
  y | Data array.
  outGradInput | [in,out] The gradient of the inputs.
  outHyperGrad | [in,out] The gradient of the hyper parameters.
  alpha | (Optional) The alpha ratio.

Returns
  The calculated log z coordinate emission.

## ◆ GetNumParameters()

template<typename Scalar >

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

Gets number of parameters to be optimized.

, 26.06.2018.

Returns
  The number parameters.

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

## ◆ SetParameters()

template<typename Scalar >

virtual void NeuralEngine::MachineLearning::GPModels::GaussEmission< 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 >.

## ◆ GetParameters()

template<typename Scalar >

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

Gets the parameters for each optimization iteration.

, 26.06.2018.

Returns
  The parameters.

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

## ◆ UpdateParameters()

template<typename Scalar >

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

Updates the parameters.

, 26.06.2018.

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

## ◆ serialize()

template<typename Scalar >
template<class Archive >

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

Definition at line 176 of file FgGaussEmissionLayer.h.

## Friends And Related Function Documentation

## ◆ boost::serialization::access

template<typename Scalar >

friend class boost::serialization::access
| friend

Definition at line 173 of file FgGaussEmissionLayer.h.

## Member Data Documentation

## ◆ afY

template<typename Scalar >

af::array NeuralEngine::MachineLearning::GPModels::GaussEmission< Scalar >::afY
| protected

Default constructor.

, 26.06.2018.

Definition at line 165 of file FgGaussEmissionLayer.h.

## ◆ afU

template<typename Scalar >

af::array NeuralEngine::MachineLearning::GPModels::GaussEmission< Scalar >::afU
| protected

Definition at line 166 of file FgGaussEmissionLayer.h.

## ◆ afR

template<typename Scalar >

af::array NeuralEngine::MachineLearning::GPModels::GaussEmission< Scalar >::afR
| protected

Definition at line 167 of file FgGaussEmissionLayer.h.

## ◆ iq

template<typename Scalar >

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

Definition at line 169 of file FgGaussEmissionLayer.h.

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

- FgGaussEmissionLayer.h