Base class with abstract and basic function definitions. All deep GP models will be derived from this class.
More...
#include <FgGPLVMBaseModel.h>
Public Member Functions | |
GPLVMBaseModel (const af::array &Y, int latentDimension, Scalar priorMean=0.0, Scalar priorVariance=1.0, LogLikType lType=LogLikType::Gaussian, XInit emethod=XInit::pca) | |
Constructor. More... | |
GPLVMBaseModel () | |
Default constructor. More... | |
virtual | ~GPLVMBaseModel () |
Destructor. More... | |
virtual void | Optimise (OptimizerType method=L_BFGS, Scalar tol=0.0, bool reinit_hypers=true, int maxiter=1000, int mb_size=0, LineSearchType lsType=MoreThuente, bool disp=true, int *cycle=nullptr) override |
Optimizes the model parameters for best fit. More... | |
virtual bool | Init (af::array &mx) |
Initializes the model. More... | |
virtual bool | Init () override |
Initializes the model. More... | |
virtual void | PosteriorLatents (af::array &mx, af::array &vx) |
Get posterior distribution of latent variables /f$\mathbf{X}/f$. More... | |
virtual int | GetNumParameters () override |
Gets number of parameters. 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 | UpdateParameters () override |
Updates the parameters. More... | |
virtual void | FixKernelParameters (bool isfixed) |
Sets fixation for hyperparameters. More... | |
virtual void | FixInducing (bool isfixed) |
Set fixation for inducing inputs. More... | |
void | FixLatents (bool isFixed) |
af::array | GetMeanGradient () |
Gets prior mean gradient. More... | |
af::array | GetVarGradient () |
Gets prior variance gradient. More... | |
void | SetPrior (const af::array mean, const af::array var) |
Sets the prior. More... | |
void | SetPriorCavity (const af::array meanCav, const af::array varCav) |
Sets the cavity prior. More... | |
void | SetLatentGradient (const af::array &dmParent, const af::array &dvParent) |
Sets latent gradient. More... | |
void | SetLatentGradientCavity (const af::array &dmParent, const af::array &dvParent) |
Sets the latent cavity gradient. More... | |
int | GetLatentDimension () |
Gets latent dimension. More... | |
void | SetBackConstraint (IBackconstraint< Scalar > *constraint) |
Sets a back-constraint. More... | |
IBackconstraint< Scalar > * | GetBackConstraint () |
Gets the back-constraint. More... | |
void | SetStyles (std::map< std::string, Style< Scalar > > *styles) |
Sets the syles. More... | |
void | AddStyle (Style< Scalar > style) |
Adds a style. More... | |
std::map< std::string, Style< Scalar > > * | GetStyles () |
Gets the styles. More... | |
![]() | |
GPBaseModel (const af::array &Y, LogLikType lType=LogLikType::Gaussian, ModelType mtype=ModelType::GPR) | |
Constructor. More... | |
GPBaseModel () | |
Default Constructor. More... | |
virtual | ~GPBaseModel () |
Destructor. More... | |
virtual void | Optimise (OptimizerType method=L_BFGS, Scalar tol=0.0, bool reinit_hypers=true, int maxiter=1000, int mb_size=0, LineSearchType lsType=MoreThuente, bool disp=true, int *cycle=nullptr) |
Optimizes the model parameters for best fit. More... | |
virtual bool | Init () |
Initializes the model. More... | |
virtual void | PredictF (const af::array &testInputs, af::array &mf, af::array &vf) |
Predict noise free functions values \(\mathbf{F}_*\). More... | |
virtual void | PredictY (const af::array &testInputs, af::array &my, af::array &vy) |
Prediction of test outputs \(\mathbf{Y}_*\). More... | |
virtual void | SampleY (const af::array inputs, int numSamples, af::array &outFunctions) |
Generate function samples from posterior. More... | |
virtual void | AddData (const af::array Ytrain) |
Adds training data to the model. More... | |
af::array | GetTrainingData () |
Gets the training data set Y. More... | |
void | SetTrainingData (af::array &data) |
Sets training data Y. More... | |
virtual int | GetNumParameters () |
Gets number of parameters. 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 | UpdateParameters () |
Updates the parameters. More... | |
virtual void | FixLikelihoodParameters (bool isfixed) |
Sets the likelihood parameters to be fixed or not for optimization. More... | |
void | SetSegments (af::array segments) |
Sets fixation for hyperparameters. More... | |
af::array | GetSegments () |
Gets the start index array for the sequences. More... | |
![]() | |
virtual Scalar | Function (const af::array &x, af::array &outGradient) |
Cost function the given x inputs. 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... | |
int | GetDataLenght () |
Gets data lenght. More... | |
int | GetDataDimensionality () |
Gets data dimensionality. More... | |
ModelType | GetModelType () |
Gets model type. More... | |
virtual void | SetBatchSize (int size) |
Sets batch size. More... | |
int | GetBatchSize () |
Gets batch size. More... | |
void | SetIndexes (af::array &indexes) |
Sets the batch indexes. More... | |
![]() | |
GPNode () | |
Default constructor. More... | |
virtual | ~GPNode () |
Destructor. More... | |
int | GetNumChildren () const |
Gets the number of children of this item. More... | |
int | AttachChild (std::shared_ptr< GPNode< Scalar > > const &child) |
Attaches a child. More... | |
int | DetachChild (std::shared_ptr< GPNode< Scalar > > const &child) |
Detaches a child. More... | |
std::shared_ptr< GPNode< Scalar > > | DetachChildAt (int i) |
Detaches a child at index. More... | |
void | DetachAllChildren () |
Detach all children from this node. More... | |
std::shared_ptr< GPNode< Scalar > > | SetChild (int i, std::shared_ptr< GPNode< Scalar > > const &child) |
Sets a child. More... | |
std::shared_ptr< GPNode< Scalar > > | GetChild (int i) |
Gets a child at index. More... | |
GPNode< Scalar > * | GetParent () |
Access to the parent object, which is null for the root of the hierarchy. More... | |
void | SetParent (GPNode< Scalar > *parent) |
Access to the parent object. Node calls this during attach/detach of children. More... | |
Protected Member Functions | |
virtual af::array | PosteriorGradientLatents (const af::array &dmx, const af::array &dvx) |
Posterior gradient of latent inputs /f$\mathbf{X}/f$. More... | |
virtual void | UpdateParametersInternal () |
Updates the internal parameters. More... | |
virtual af::array | LatentGradient (const af::array &dm, const af::array &dv) |
Latent gradient. More... | |
![]() | |
IModel (int numData, int numDimension, ModelType type) | |
Constructor. More... | |
Protected Attributes | |
int | iq |
latent dimension More... | |
Scalar | dPriorMean |
prior mean More... | |
Scalar | dPriorVariance |
prior variance More... | |
Scalar | dPriorX1 |
prior /f$x_1/f$ More... | |
Scalar | dPriorX2 |
prior /f$x_2/f$ More... | |
af::array | afFactorX1 |
natural parameter factor 1 for latent variable More... | |
af::array | afFactorX2 |
natural parameter factor 2 for latent variable More... | |
af::array | afPosteriorX1 |
posterior natural parameter 1 for latent variable More... | |
af::array | afPosteriorX2 |
posterior natural parameter 2 for latent variable More... | |
af::array | afPriorMean |
prior mean for hiersrchy mode More... | |
af::array | afPriorVariance |
prior variance for hiersrchy mode More... | |
af::array | afPriorMeanCav |
prior mean for hiersrchy mode More... | |
af::array | afPriorVarianceCav |
prior variance for hiersrchy mode More... | |
af::array | afPriorX1 |
prior /f$x_1/f$ More... | |
af::array | afPriorX2 |
prior /f$x_2/f$ More... | |
af::array | afPriorX1Cav |
prior /f$x_1/f$ More... | |
af::array | afPriorX2Cav |
prior /f$x_2/f$ More... | |
af::array | afGradMean |
prior mean gradient for hiersrchy mode More... | |
af::array | afGradVariance |
prior variance gradient for hiersrchy mode More... | |
af::array | afGradMeanCav |
prior mean gradient for hiersrchy mode More... | |
af::array | afGradVarianceCav |
prior variance gradient for hiersrchy mode More... | |
af::array | afLatentGradientX |
top down gradient More... | |
XInit | eEmMethod |
IBackconstraint< Scalar > * | backConst |
back-constraint More... | |
std::map< std::string, Style< Scalar > > * | mStyles |
style variable More... | |
bool | bIsLatetsFixed |
![]() | |
bool | bInit |
check if model is initialized More... | |
af::array | afY |
training dataset, mean substracted More... | |
af::array | afBias |
the bias More... | |
af::array | afSegments |
Index of starting positions for all trials. More... | |
LikelihoodBaseLayer< Scalar > * | likLayer |
liklihood layer More... | |
![]() | |
ModelType | mType |
int | iN |
dataset length More... | |
int | iD |
dataset dimension More... | |
int | iBatchSize |
size of the batch More... | |
af::array | afIndexes |
indexes of /f$\mathbf{X}/f$ for batch learning More... | |
af::dtype | m_dType |
floating point precision flag for af::array More... | |
![]() | |
std::vector< std::shared_ptr< GPNode< Scalar > > > | mChild |
GPNode< Scalar > * | mParent |
Private Member Functions | |
template<class Archive > | |
void | serialize (Archive &ar, unsigned int version) |
Friends | |
class | boost::serialization::access |
class | KBR< Scalar > |
class | PTC< Scalar > |
Base class with abstract and basic function definitions. All deep GP models will be derived from this class.
HmetalT, 26.10.2017.
Definition at line 294 of file FgGPLVMBaseModel.h.
NeuralEngine::MachineLearning::GPModels::GPLVMBaseModel< Scalar >::GPLVMBaseModel | ( | const af::array & | Y, |
int | latentDimension, | ||
Scalar | priorMean = 0.0 , |
||
Scalar | priorVariance = 1.0 , |
||
LogLikType | lType = LogLikType::Gaussian , |
||
XInit | emethod = XInit::pca |
||
) |
Constructor.
, 26.03.2018.
Y | The data af::array to process. |
latentDimension | The training inputs. |
priorMean | (Optional) The description for one hidden layer. |
priorVariance | (Optional) The prior variance. |
numInducing | (Optional) Number of inducings. |
lType | (Optional) the loglik type. |
emethod | (Optional) The emethod. |
NeuralEngine::MachineLearning::GPModels::GPLVMBaseModel< Scalar >::GPLVMBaseModel | ( | ) |
Default constructor.
Hmetal T, 31/03/2020.
|
virtual |
Destructor.
, 15.05.2018.
|
overridevirtual |
Optimizes the model parameters for best fit.
Hmetal T, 29.11.2017.
method | (Optional) the optimization method. |
tol | (Optional) the tolerance. |
reinit_hypers | (Optional) true to re hypers. |
maxiter | (Optional) max iterations. |
mb_size | (Optional) batch size. |
LSType | (Optional) linesearch type. |
disp | (Optional) true to disp. |
Reimplemented from NeuralEngine::MachineLearning::GPModels::GPBaseModel< Scalar >.
|
virtual |
Initializes the model.
Hmetal T, 29.11.2017.
|
overridevirtual |
Initializes the model.
Hmetal T, 29.11.2017.
Reimplemented from NeuralEngine::MachineLearning::GPModels::GPBaseModel< Scalar >.
Reimplemented in NeuralEngine::MachineLearning::GPModels::SparseDeepGPLVMBaseModel< Scalar >, and NeuralEngine::MachineLearning::GPModels::SparseGPLVMBaseModel< Scalar >.
|
virtual |
Get posterior distribution of latent variables /f$\mathbf{X}/f$.
Hmetal T, 09/12/2019.
index | Index of selected inputs. |
mx | [in,out] The mean. |
vx | [in,out] The variance. |
|
overridevirtual |
Gets number of parameters.
, 26.06.2018.
Reimplemented from NeuralEngine::MachineLearning::GPModels::GPBaseModel< Scalar >.
Reimplemented in NeuralEngine::MachineLearning::GPModels::SparseDeepGPLVMBaseModel< Scalar >, and NeuralEngine::MachineLearning::GPModels::SparseGPLVMBaseModel< Scalar >.
|
overridevirtual |
Sets the parameters for each optimization iteration.
, 26.06.2018.
param | The parameter. |
Reimplemented from NeuralEngine::MachineLearning::GPModels::GPBaseModel< Scalar >.
Reimplemented in NeuralEngine::MachineLearning::GPModels::SparseDeepGPLVMBaseModel< Scalar >, and NeuralEngine::MachineLearning::GPModels::SparseGPLVMBaseModel< Scalar >.
|
overridevirtual |
Gets the parameters for each optimization iteration.
, 26.06.2018.
param | The parameter. |
Reimplemented from NeuralEngine::MachineLearning::GPModels::GPBaseModel< Scalar >.
Reimplemented in NeuralEngine::MachineLearning::GPModels::SparseDeepGPLVMBaseModel< Scalar >, and NeuralEngine::MachineLearning::GPModels::SparseGPLVMBaseModel< Scalar >.
|
overridevirtual |
Updates the parameters.
, 26.06.2018.
Reimplemented from NeuralEngine::MachineLearning::GPModels::GPBaseModel< Scalar >.
Reimplemented in NeuralEngine::MachineLearning::GPModels::SparseDeepGPLVMBaseModel< Scalar >, and NeuralEngine::MachineLearning::GPModels::SparseGPLVMBaseModel< Scalar >.
|
virtual |
Sets fixation for hyperparameters.
Hmetal T, 16/12/2019.
isfixed | True if isfixed. |
Reimplemented in NeuralEngine::MachineLearning::GPModels::SparseDeepGPLVMBaseModel< Scalar >, and NeuralEngine::MachineLearning::GPModels::SparseGPLVMBaseModel< Scalar >.
|
virtual |
Set fixation for inducing inputs.
Hmetal T, 16/12/2019.
isfixed | True if isfixed. |
Reimplemented in NeuralEngine::MachineLearning::GPModels::SparseGPLVMBaseModel< Scalar >.
af::array NeuralEngine::MachineLearning::GPModels::GPLVMBaseModel< Scalar >::GetMeanGradient | ( | ) |
Gets prior mean gradient.
Hmetal T, 31/08/2020.
af::array NeuralEngine::MachineLearning::GPModels::GPLVMBaseModel< Scalar >::GetVarGradient | ( | ) |
Gets prior variance gradient.
Hmetal T, 31/08/2020.
void NeuralEngine::MachineLearning::GPModels::GPLVMBaseModel< Scalar >::SetPrior | ( | const af::array | mean, |
const af::array | var | ||
) |
Sets the prior.
Hmetal T, 01/09/2020.
mean | The mean. |
var | The variable. |
void NeuralEngine::MachineLearning::GPModels::GPLVMBaseModel< Scalar >::SetPriorCavity | ( | const af::array | meanCav, |
const af::array | varCav | ||
) |
Sets the cavity prior.
Hmetal T, 20/04/2021.
meanCav | The mean cav. |
varCav | The variable cav. |
void NeuralEngine::MachineLearning::GPModels::GPLVMBaseModel< Scalar >::SetLatentGradient | ( | const af::array & | dmParent, |
const af::array & | dvParent | ||
) |
Sets latent gradient.
Hmetal T, 20/04/2021.
dmParent | The dm parent. |
dvParent | The dv parent. |
void NeuralEngine::MachineLearning::GPModels::GPLVMBaseModel< Scalar >::SetLatentGradientCavity | ( | const af::array & | dmParent, |
const af::array & | dvParent | ||
) |
Sets the latent cavity gradient.
Hmetal T, 20/04/2021.
dmParent | The dm parent. |
dvParent | The dv parent. |
int NeuralEngine::MachineLearning::GPModels::GPLVMBaseModel< Scalar >::GetLatentDimension | ( | ) |
Gets latent dimension.
Hmetal T, 01/09/2020.
void NeuralEngine::MachineLearning::GPModels::GPLVMBaseModel< Scalar >::SetBackConstraint | ( | IBackconstraint< Scalar > * | constraint | ) |
Sets a back-constraint.
Hmetal T, 17/09/2020.
constraint | The constraint. |
IBackconstraint< Scalar > * NeuralEngine::MachineLearning::GPModels::GPLVMBaseModel< Scalar >::GetBackConstraint | ( | ) |
Gets the back-constraint.
Hmetal T, 17/09/2020.
void NeuralEngine::MachineLearning::GPModels::GPLVMBaseModel< Scalar >::SetStyles | ( | std::map< std::string, Style< Scalar > > * | styles | ) |
Sets the syles.
Hmetal T, 25/09/2020.
styles | [in,out] If non-null, the styles. |
void NeuralEngine::MachineLearning::GPModels::GPLVMBaseModel< Scalar >::AddStyle | ( | Style< Scalar > | style | ) |
Adds a style.
Hmetal T, 02/11/2020.
styles | The styles. |
std::map< std::string, Style< Scalar > > * NeuralEngine::MachineLearning::GPModels::GPLVMBaseModel< Scalar >::GetStyles | ( | ) |
Gets the styles.
Hmetal T, 25/09/2020.
|
protectedvirtual |
Posterior gradient of latent inputs /f$\mathbf{X}/f$.
Hmetal T, 09/12/2019.
dmx | [in,out] The gradient of the mean. |
dvx | [in,out] The the gradient of the variance. |
|
protectedvirtual |
Updates the internal parameters.
Hmetal T, 23/03/2020.
|
protectedvirtual |
Latent gradient.
Hmetal T, 20/04/2021.
|
inlineprivate |
Definition at line 615 of file FgGPLVMBaseModel.h.
|
friend |
Definition at line 610 of file FgGPLVMBaseModel.h.
Definition at line 610 of file FgGPLVMBaseModel.h.
Definition at line 610 of file FgGPLVMBaseModel.h.
|
protected |
latent dimension
Definition at line 575 of file FgGPLVMBaseModel.h.
|
protected |
prior mean
Definition at line 577 of file FgGPLVMBaseModel.h.
|
protected |
prior variance
Definition at line 578 of file FgGPLVMBaseModel.h.
|
protected |
prior /f$x_1/f$
Definition at line 579 of file FgGPLVMBaseModel.h.
|
protected |
prior /f$x_2/f$
Definition at line 580 of file FgGPLVMBaseModel.h.
|
protected |
natural parameter factor 1 for latent variable
Definition at line 582 of file FgGPLVMBaseModel.h.
|
protected |
natural parameter factor 2 for latent variable
Definition at line 583 of file FgGPLVMBaseModel.h.
|
protected |
posterior natural parameter 1 for latent variable
Definition at line 584 of file FgGPLVMBaseModel.h.
|
protected |
posterior natural parameter 2 for latent variable
Definition at line 585 of file FgGPLVMBaseModel.h.
|
protected |
prior mean for hiersrchy mode
Definition at line 587 of file FgGPLVMBaseModel.h.
|
protected |
prior variance for hiersrchy mode
Definition at line 588 of file FgGPLVMBaseModel.h.
|
protected |
prior mean for hiersrchy mode
Definition at line 589 of file FgGPLVMBaseModel.h.
|
protected |
prior variance for hiersrchy mode
Definition at line 590 of file FgGPLVMBaseModel.h.
|
protected |
prior /f$x_1/f$
Definition at line 591 of file FgGPLVMBaseModel.h.
|
protected |
prior /f$x_2/f$
Definition at line 592 of file FgGPLVMBaseModel.h.
|
protected |
prior /f$x_1/f$
Definition at line 593 of file FgGPLVMBaseModel.h.
|
protected |
prior /f$x_2/f$
Definition at line 594 of file FgGPLVMBaseModel.h.
|
protected |
prior mean gradient for hiersrchy mode
Definition at line 595 of file FgGPLVMBaseModel.h.
|
protected |
prior variance gradient for hiersrchy mode
Definition at line 596 of file FgGPLVMBaseModel.h.
|
protected |
prior mean gradient for hiersrchy mode
Definition at line 597 of file FgGPLVMBaseModel.h.
|
protected |
prior variance gradient for hiersrchy mode
Definition at line 598 of file FgGPLVMBaseModel.h.
|
protected |
top down gradient
Definition at line 600 of file FgGPLVMBaseModel.h.
|
protected |
Definition at line 602 of file FgGPLVMBaseModel.h.
|
protected |
back-constraint
Definition at line 604 of file FgGPLVMBaseModel.h.
|
protected |
style variable
Definition at line 605 of file FgGPLVMBaseModel.h.
|
protected |
Definition at line 607 of file FgGPLVMBaseModel.h.