Compound kernel function. More...
#include <FgCompoundKernel.h>
Public Member Functions | |
CompoundKernel () | |
Default constructor. More... | |
~CompoundKernel () | |
Destructor. More... | |
void | AddKernel (IKernel< Scalar > *kernel, af::array index) |
Adds a kernel object and the corresponding column index of X for computation. More... | |
void | ComputeKernelMatrix (const af::array &inX1, const af::array &inX2, af::array &outMatrix) |
Computes the kernel matrix of the kernel. More... | |
void | ComputeDiagonal (const af::array &inX, af::array &outDiagonal) |
Calculates only diagonal elements of K. More... | |
void | LogLikGradientX (const af::array &inX, const af::array &indL_dK, af::array &outdL_dX) |
Computes dL/dX for full fit GP. More... | |
void | LogLikGradientX (const af::array &inXu, const af::array &indL_dKuu, const af::array &inX, const af::array &indL_dKuf, af::array &outdL_dXu, af::array &outdL_dX) |
Computes dL / dX and dL / dXu for sparse approximation GP. More... | |
void | LogLikGradientParam (const af::array &inX1, const af::array &inX2, const af::array &indL_dK, af::array &outdL_dParam) |
Computes the gradient of the kernel parameters. More... | |
void | GradX (const af::array &inX1, const af::array &inX2, int q, af::array &outdK_dX) |
Computes dK/dX. More... | |
void | DiagGradX (const af::array &inX, af::array &outDiagdK_dX) |
Derivative of diagonal elemts of K w.r.t X. More... | |
void | DiagGradParam (const af::array &inX, const af::array &inCovDiag, af::array &outDiagdK_dParam) |
Derivative of diagonal elemts of K w.r.t kernel parameters. More... | |
void | SetParameters (const af::array ¶m) |
Sets the parameters. More... | |
af::array | GetParameters () |
Gets the parameters. More... | |
void | Psi1Derivative (const af::array &inPsi1, const af::array &indL_dpsi1, const af::array &inZ, const af::array &inMu, const af::array &inSu, af::array &outdL_dParam, af::array &outdL_dXu, af::array *outdL_dX=nullptr) |
PSI statistics. | |
![]() | |
IKernel (KernelType type, int numParameters) | |
Constructor. More... | |
virtual | ~IKernel () |
Destructor. More... | |
virtual int | GetNumParameter () |
Gets number of parametes of the kernel. More... | |
virtual KernelType | GetKernelType () |
Gets kernel type. More... | |
virtual void | ComputeKernelMatrix (const af::array &inX1, const af::array &inX2, af::array &outMatrix)=0 |
Computes the kernel matrix of the kernel. More... | |
virtual void | ComputeDiagonal (const af::array &inX, af::array &outDiagonal)=0 |
Calculates only diagonal elements of K. More... | |
virtual void | LogLikGradientX (const af::array &inX, const af::array &indL_dK, af::array &outdL_dX)=0 |
Computes dL/dX for full fit GP. More... | |
virtual void | LogLikGradientX (const af::array &inXu, const af::array &indL_dKuu, const af::array &inX, const af::array &indL_dKuf, af::array &outdL_dXu, af::array &outdL_dX)=0 |
Computes dL / dX and dL / dXu for sparse approximation GP. More... | |
virtual void | LogLikGradientX (const af::array &inX1, const af::array &inX2, const af::array &indL_dK, af::array &outdL_dX) |
Computes dL / dX for sparse approximation GP. More... | |
virtual void | LogLikGradientParam (const af::array &inX1, const af::array &inX2, const af::array &indL_dK, af::array &outdL_dParam)=0 |
Computes the gradient of LL w.r.t. the kernel parameters. More... | |
virtual void | LogLikGradientParam (const af::array &inX1, const af::array &inX2, const af::array &indL_dK, af::array &outdL_dParam, const af::array *dlogZ_dv) |
Computes the gradient of LL w.r.t. the kernel parameters. More... | |
virtual void | LogLikGradientCompundKfu (const af::array &indL_dKfu, const af::array &inX, const af::array &inXu, af::array *outdL_dParam, af::array *outdL_dXu, const af::array *dlogZ_dv=nullptr, af::array *outdL_dX=nullptr) |
virtual void | LogGradientCompoundKuu (const af::array &inXu, const af::array &inCovDiag, af::array *outdL_dParam, af::array *outdL_dXu) |
virtual void | GradX (const af::array &inX1, const af::array &inX2, int q, af::array &outdK_dX)=0 |
Computes dK/dX. More... | |
virtual void | DiagGradX (const af::array &inX, af::array &outDiagdK_dX)=0 |
Derivative of diagonal elemts of K w.r.t X. More... | |
virtual void | DiagGradParam (const af::array &inX, const af::array &inCovDiag, af::array &outDiagdK_dParam)=0 |
Derivative of diagonal elemts of K w.r.t kernel parameters. More... | |
virtual void | SetParameters (const af::array ¶m)=0 |
Sets the parameters. More... | |
virtual void | SetLogParameters (const af::array ¶m) |
Sets log parameters. More... | |
virtual af::array | GetParameters ()=0 |
Gets the parameters. More... | |
virtual af::array | GetLogParameters () |
Gets log parameters. More... | |
virtual void | InitParameters (Scalar inMedian) |
Initializes the parameters based on the median of the distances of /f$\mathbf{X}/f$. More... | |
virtual void | ComputePsiStatistics (const af::array &inXu, const af::array &inMu, const af::array &inS, af::array &outPsi0, af::array &outPsi1, af::array &outPsi2) |
PSI statistics. More... | |
virtual void | PsiDerivatives (const af::array &indL_dPsi0, const af::array &inPsi1, const af::array &indL_dPsi1, const af::array &inPsi2, const af::array &indL_dPsi2, const af::array &inXu, const af::array &inMu, const af::array &inS, af::array &outdL_dParam, af::array &outdL_dXu, af::array &outdL_dMu, af::array &outdL_dS, const af::array *dlogZ_dv=nullptr) |
Psi derivatives. More... | |
Private Member Functions | |
template<class Archive > | |
void | serialize (Archive &ar, unsigned int version) |
Private Attributes | |
std::vector< IKernel< Scalar > * > | vKernel |
std::vector< af::array > | vIndex |
Friends | |
class | boost::serialization::access |
Additional Inherited Members | |
![]() | |
IKernel () | |
Default constructor. More... | |
![]() | |
KernelType | eType |
int | iNumParam |
af::dtype | m_dType |
Scalar | sDegree |
af::array | afGHx |
af::array | afGHw |
af::array | afXs |
bool | bCacheK |
Compound kernel function.
Kernel function constructed as follows:
\[k(\mathbf{x}, \mathbf{x}') = \sum_m k_m(\mathbf{x}, \mathbf{x}').\]
Elementwise addition of kernel matrices constructed from different kernel functions.
Example, adding noise term to a rbf kernel function,
\[k(\mathbf{x}, \mathbf{x}') = \gamma_1 \exp\left(-\frac{1}{\gamma_2} | \mathbf{x} - \mathbf{x}'|^2\right) + \beta^{-1} \delta_{\mathbf{x}, \mathbf{x}'},\]
can be constructed with a compound kernel as follows,
\[k_{comp}(\mathbf{x}, \mathbf{x}') = k_{rbf}(\mathbf{x}, \mathbf{x}') + k_{white}(\mathbf{x}, \mathbf{x}').\]
Admin, 5/24/2017.
Definition at line 43 of file FgCompoundKernel.h.
NeuralEngine::MachineLearning::CompoundKernel< Scalar >::CompoundKernel | ( | ) |
Default constructor.
Admin, 5/24/2017.
NeuralEngine::MachineLearning::CompoundKernel< Scalar >::~CompoundKernel | ( | ) |
Destructor.
Admin, 5/24/2017.
void NeuralEngine::MachineLearning::CompoundKernel< Scalar >::AddKernel | ( | IKernel< Scalar > * | kernel, |
af::array | index | ||
) |
Adds a kernel object and the corresponding column index of X for computation.
Admin, 5/31/2017.
kernel | [in,out] If non-null, the kernel. |
index | Index of dimensions assotiated to the kernel. |
|
virtual |
Computes the kernel matrix of the kernel.
Admin, 5/23/2017.
inX1 | [in,out] First n times q matrix of latent points. |
inX2 | [in,out] Second m times q matrix of latent points (X'). |
outMatrix | [in,out] Resulting kernel matrix.< / param> |
Implements NeuralEngine::MachineLearning::IKernel< Scalar >.
|
virtual |
Calculates only diagonal elements of K.
Admin, 5/24/2017.
inX | [in,out] Nxq matrix X. |
outDiagonal | [in,out] The out diagonal. |
Implements NeuralEngine::MachineLearning::IKernel< Scalar >.
|
virtual |
Computes dL/dX for full fit GP.
Admin, 5/23/2017.
inX | [in,out] Nxq Matrix of latent points. |
indL_dK | [in,out] Derivative of the loglikelihood w.r.t kernel matrix K. |
outdL_dX | [in,out] Derivative of the loglikelihood w.r.t latent points. |
Implements NeuralEngine::MachineLearning::IKernel< Scalar >.
|
virtual |
Computes dL / dX and dL / dXu for sparse approximation GP.
Admin, 5/23/2017.
inXu | [in,out] kxq Matrix of latent subset points. |
indL_dKuu | [in,out] Derivative of the loglikelihood w.r.t subset kernel matrix Kuu. |
inX | [in,out] Nxq Matrix of latent points. |
indL_dKuf | [in,out] Derivative of the loglikelihood w.r.t the kernel matrix K. |
outdL_dXu | [in,out] Derivative of the loglikelihood w.r.t latent subset points Xu. |
outdL_dX | [in,out] Derivative of the loglikelihood w.r.t latent points X. |
Implements NeuralEngine::MachineLearning::IKernel< Scalar >.
|
virtual |
Computes the gradient of the kernel parameters.
Admin, 5/23/2017.
indL_dK | [in,out] Derivative of the loglikelihood w.r.t the kernel matrix K. |
outdL_dParam | [in,out] Gradient of kernel parameters. |
Implements NeuralEngine::MachineLearning::IKernel< Scalar >.
|
virtual |
Computes dK/dX.
Admin, 5/23/2017.
inX1 | [in,out] First n times q matrix of latent points. |
inX2 | [in,out] Second n times q matrix of latent points (X'). |
q | The latent dimension to process. |
outdK_dX | [in,out] dK/dX. |
Implements NeuralEngine::MachineLearning::IKernel< Scalar >.
|
virtual |
Derivative of diagonal elemts of K w.r.t X.
Admin, 5/23/2017.
inX | [in,out] The in x coordinate. |
outDiagdK_dX | [in,out] Derivative of diagonal elemts of K w.r.t X. |
Implements NeuralEngine::MachineLearning::IKernel< Scalar >.
|
virtual |
Derivative of diagonal elemts of K w.r.t kernel parameters.
Admin, 5/23/2017.
inX | [in,out] Nxq matrix of Latent points X. |
inCovDiag | [in,out] Diagonal of kernel matrix K. |
outDiagdK_dParam | [in,out] Derivative of diagonal elemts of K w.r.t kernel parameters. |
Implements NeuralEngine::MachineLearning::IKernel< Scalar >.
|
virtual |
Sets the parameters.
, 26.06.2018.
param | The parameter. |
Implements NeuralEngine::MachineLearning::IKernel< Scalar >.
|
virtual |
Gets the parameters.
, 26.06.2018.
Implements NeuralEngine::MachineLearning::IKernel< Scalar >.
|
inlineprivate |
Definition at line 200 of file FgCompoundKernel.h.
|
friend |
Definition at line 197 of file FgCompoundKernel.h.
|
private |
Definition at line 209 of file FgCompoundKernel.h.
|
private |
Definition at line 210 of file FgCompoundKernel.h.