Sparse GP layer. More...
#include <FgPEPSparseGPLayer.h>


Public Member Functions | |
| SGPLayer (int numPoints, int numPseudos, int outputDim, int inputDim) | |
| Constructor. More... | |
| virtual | ~SGPLayer () |
| Destructor. More... | |
| void | ForwardPredictionCavity (af::array &mout, af::array &vout, af::array &n, af::array &mx, af::array *vx=nullptr, Scalar alpha=1.0) |
| Forward prediction through cavity. More... | |
| void | BackpropGradientsReg (af::array &m, af::array &v, af::array &dlogZ_dm, af::array &dlogZ_dv, af::array &x, std::map< std::string, af::array > &grad_hyper, std::map< std::string, af::array > &grad_cav, Scalar alpha=1.0) |
| Prediction of posterior function values. More... | |
| void | UpdateFactor (af::array &n, std::map< std::string, af::array > grad_cav, Scalar alpha, Scalar decay=0) |
| Update step of PowerEP. 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::SparseGPBaseLayer< Scalar > | |
| 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 ¶m) 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 ¶m) |
| 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 ¶m)=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 | |
| SGPLayer () | |
| Default constructor. More... | |
| void | ForwardPredictionDeterministicPost (af::array &mx, af::array *mout, af::array *vout) |
| void | ForwardPredictionDeterministicCavity (af::array &mout, af::array &vout, af::array &idx, af::array &mx, Scalar alpha=1.0) |
| Forward prediction through deterministic cavity. More... | |
| void | ForwardPredictionRandomCavity (af::array &mout, af::array &vout, af::array &idx, af::array &mx, af::array &vx, Scalar alpha=1.0) |
| Forward prediction through random cavity. More... | |
| void | ComputeCavity (af::array &idx, af::array &muhat, af::array &Suhat, af::array &T1uHat, af::array &T2uHat, Scalar alpha=1.0f) |
| Calculates the cavity. More... | |
Protected Member Functions inherited from NeuralEngine::MachineLearning::GPModels::SparseGPBaseLayer< Scalar > | |
| 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 | |
| af::array | gamma |
| af::array | beta |
| af::array | afMuHat |
| af::array | afSuHat |
| af::array | afInvSuHat |
| af::array | afInvSuMuHat |
Protected Attributes inherited from NeuralEngine::MachineLearning::GPModels::SparseGPBaseLayer< Scalar > | |
| 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 |
Sparse GP layer.
Holds all variables for FITC approximation and PEP. Defines a subset of X. Selects k inducing inputs Xu, computes the subset kernel matrix Kuu and its inverse.
For more information see, https://pdfs.semanticscholar.org/99f9/3283e415ae21bd42a90031cd3972f3bfbc9d.pdf
Hmetal T, 05/05/2018.
Definition at line 37 of file FgPEPSparseGPLayer.h.
| NeuralEngine::MachineLearning::GPModels::PowerEP::SGPLayer< Scalar >::SGPLayer | ( | int | numPoints, |
| int | numPseudos, | ||
| int | outputDim, | ||
| int | inputDim | ||
| ) |
Constructor.
, 15.05.2018.
| numPoints | Number of points. |
| numPseudos | Number of pseudo inputs. |
| outputDim | The output dimension. |
| inputDim | The input dimension. |
|
virtual |
Destructor.
, 15.05.2018.
|
inlineprotected |
| void NeuralEngine::MachineLearning::GPModels::PowerEP::SGPLayer< Scalar >::ForwardPredictionCavity | ( | af::array & | mout, |
| af::array & | vout, | ||
| af::array & | n, | ||
| af::array & | mx, | ||
| af::array * | vx = nullptr, |
||
| Scalar | alpha = 1.0 |
||
| ) |
Forward prediction through cavity.
Computes new mean m^{
}_{f} and covariance V^{
}_{ff} function. From cavity distribution.
, 16.05.2018.
| mout | [in,out] The m^{ }_{f}. |
| vout | [in,out] The V^{ }_{ff}. |
| n | [in,out] indexes of points to be removed from distribution. |
| mx | [in,out] The inputs mx. |
| vx | [in,out] (Optional) If non-null, the variances vx. |
| alpha | (Optional) the alpha, weighning for alpha-divergence. |
| void NeuralEngine::MachineLearning::GPModels::PowerEP::SGPLayer< Scalar >::BackpropGradientsReg | ( | af::array & | m, |
| af::array & | v, | ||
| af::array & | dlogZ_dm, | ||
| af::array & | dlogZ_dv, | ||
| af::array & | x, | ||
| std::map< std::string, af::array > & | grad_hyper, | ||
| std::map< std::string, af::array > & | grad_cav, | ||
| Scalar | alpha = 1.0 |
||
| ) |
Prediction of posterior function values.
, 12.06.2018.
| testX | [in,out] The test inputs. |
| mf | [in,out] mean function values. |
| vf | [in,out] covariance function values. |
| void NeuralEngine::MachineLearning::GPModels::PowerEP::SGPLayer< Scalar >::UpdateFactor | ( | af::array & | n, |
| std::map< std::string, af::array > | grad_cav, | ||
| Scalar | alpha, | ||
| Scalar | decay = 0 |
||
| ) |
Update step of PowerEP.
Hmetal T, 08/06/2018.
| n | [in,out] The indexes to compute. |
| grad_cav | [in,out] The gradient of the cavity functions m_f^{ } and V_{ff}^{\m}. |
| alpha | The alpha. |
| decay | (Optional) the decay. |
|
overridevirtual |
Updates the parameters.
, 26.06.2018.
Reimplemented from NeuralEngine::MachineLearning::GPModels::SparseGPBaseLayer< Scalar >.
|
overridevirtual |
Initializes the parameters.
Hmetal T, 09/12/2019.
| X | [in,out] (Optional) If non-null, an af::array to process. |
Reimplemented from NeuralEngine::MachineLearning::GPModels::SparseGPBaseLayer< Scalar >.
|
protected |
Forward prediction through deterministic cavity.
Projection step. Computation of cavity posterior mean and covariance function,
m^{\n}_{f} = K_{fu}K_{uu}^{−1}T^{\n, −1}_{2, u}T^{\n}_{1, u},
V{\n}_{ff} = K_{ff} − Q_{ff} + K_{fu}K^{−1}_{uu}T^{\n, −1}_{2, u}K^{−1}_{uu}K_{uf}.
, 16.05.2018.
| mout | [in,out] The m^{ }_{f}. |
| vout | [in,out] The V^{ }_{ff}. |
| idx | [in,out] indexes of points to be removed from distribution. |
| mx | [in,out] The inputs mx. |
| alpha | (Optional) the alpha, weighning for alpha-divergence. |
|
protected |
Forward prediction through random cavity.
, 16.05.2018.
| mout | [in,out] The m^{ }_{f}. |
| vout | [in,out] The V^{ }_{ff}. |
| idx | [in,out] indexes of points to be removed from distribution. |
| mx | [in,out] The inputs mx. |
| vx | [in,out] (Optional) If non-null, the variances vx. |
| alpha | (Optional) the alpha, weighning for alpha-divergence. |
|
protected |
Calculates the cavity.
Deletion step: The cavity for data point n, q^{
}(f) ∝ q^∗(f)/t^α_n(u), has a similar form to the posterior, but the natural parameters are modified by the deletion,
T^\n_{1, u} = T_{1, u} − αT_{1, n}
and
T^\n_{2, u} = T_{2, u} − αT_{2, n},
for yielding new mean muhat and covariance function Suhat.
, 16.05.2018.
| idx | [in,out] indexes of points to be removed from distribution. |
| muhat | [in,out] The muhat. |
| Suhat | [in,out] The Suhat. |
| T1uHat | [in,out] The cavity natural parameter T^\n_{1, u}. |
| T2uHat | [in,out] The cavity natural parameter T^\n_{2, u}. |
| alpha | (Optional) the alpha, weighning for alpha-divergence. |
|
inlineprivate |
Definition at line 201 of file FgPEPSparseGPLayer.h.
|
friend |
Definition at line 198 of file FgPEPSparseGPLayer.h.
|
protected |
Definition at line 184 of file FgPEPSparseGPLayer.h.
|
protected |
Definition at line 185 of file FgPEPSparseGPLayer.h.
|
protected |
Definition at line 192 of file FgPEPSparseGPLayer.h.
|
protected |
Definition at line 193 of file FgPEPSparseGPLayer.h.
|
protected |
Definition at line 194 of file FgPEPSparseGPLayer.h.
|
protected |
Definition at line 195 of file FgPEPSparseGPLayer.h.