Factor nodes

RxGP defines three sparse Gaussian process factor nodes. Each node represents a local GP likelihood factor in a factor graph, with message passing rules defined on every edge.

Univariate sparse GP node

The UniSGP node implements a variational sparse Gaussian process (VSGP) factor for scalar observations. It is the special case of the dID-VSGP node (see UniSGP_dID) with an identity operator $\mathcal{L} = \mathcal{I}$, so that the observation is a direct (noisy) evaluation of the latent GP.

The composite node function is obtained by collapsing the GP prior into the observation model (cf. Eq. 22 of the dID-VSGP derivation with $\mathcal{L} = \mathcal{I}$):

\[\tilde{\phi}(y, x, \mathbf{v}, w, \boldsymbol{\theta}) = \exp\!\Bigl(-\tfrac{1}{2}\, w\, A_u(x, \boldsymbol{\theta})\Bigr)\; \mathcal{N}\!\bigl(y \mid b_u(x, \mathbf{v}, \boldsymbol{\theta}),\; w^{-1}\bigr) ,\]

with the prior mean and residual variance

\[b_u(x, \mathbf{v}, \boldsymbol{\theta}) = m(x) + \mathbf{k}_{xu}(x, \boldsymbol{\theta})^\top \bigl(\mathbf{v} - K_{uu}(\boldsymbol{\theta})^{-1}\mathbf{m}_u\bigr) ,\]

\[A_u(x, \boldsymbol{\theta}) = k_{\boldsymbol{\theta}}(x, x) - \mathbf{k}_{xu}(x, \boldsymbol{\theta})^\top K_{uu}(\boldsymbol{\theta})^{-1} \mathbf{k}_{xu}(x, \boldsymbol{\theta}) ,\]

where $\mathbf{v} = K_{uu}^{-1}\mathbf{u}$ is the transformed inducing variable, $\mathbf{k}_{xu}(x) = k_{\boldsymbol{\theta}}(X_u, x) \in \mathbb{R}^M$ is the cross-kernel vector, $K_{uu} = k_{\boldsymbol{\theta}}(X_u, X_u)$, $\mathbf{m}_u = m(X_u)$, $w$ is the noise precision, and $m(x)$ is the mean function.

RxGP.UniSGPType
UniSGP

Univariate variational sparse Gaussian process (VSGP) factor node. This is the identity-operator ($\mathcal{L} = \mathcal{I}$) specialisation of the dID-VSGP node (UniSGP_dID).

The composite node function collapses the GP prior into the observation model:

\[\tilde{\phi}(y, x, \mathbf{v}, w, \boldsymbol{\theta}) = \exp\!\bigl(-\tfrac{1}{2}\, w\, A_u(x, \boldsymbol{\theta})\bigr)\; \mathcal{N}\!\bigl(y \mid b_u(x, \mathbf{v}, \boldsymbol{\theta}),\; w^{-1}\bigr)\]

where $b_u = m(x) + \mathbf{k}_{xu}^\top(\mathbf{v} - K_{uu}^{-1}\mathbf{m}_u)$ and $A_u = k(x,x) - \mathbf{k}_{xu}^\top K_{uu}^{-1} \mathbf{k}_{xu}$.

Edges: [out, in, v, w, θ] — output, input, transformed inducing variable, noise precision, kernel hyperparameters.

source

Edges:

EdgeSymbolTypeDescription
OutputoutObserved (or latent) function value
InputinℝᴰInput location (point or distribution)
Inducing variablevℝᴹTransformed inducing variable $K_{uu}^{-1}\mathbf{u}$
Noise precisionwℝ⁺Precision of the observation noise
HyperparametersθℝᵈKernel hyperparameters

Message passing rules — UniSGP

EdgeOutgoing messageSummary
outNormalMeanPrecisionPredictive mean from inducing variables projected to the observation
inContinuousUnivariateLogPdfBackward message for input inference (log-pdf form)
vBufferUniSGP{MvNormalWeightedMeanPrecision}Inducing variable update with Cholesky tracking
wGammaShapeRateGamma update for the noise precision
θContinuousUnivariateLogPdf or ContinuousMultivariateLogPdfLog-pdf for hyperparameter optimisation

Univariate sparse GP node with inter-domain observations

The UniSGP_dID node implements a decoupled inter-domain variational sparse Gaussian process (dID-VSGP) factor. It generalises UniSGP by applying an arbitrary deterministic linear operator $\mathcal{L}$ to the latent GP, so that observations live in the transformed space $\tilde{f}(x) = \mathcal{L} f(x) \in \mathbb{R}^P$ (e.g. gradients, joint function-and-gradient stacks, or differential-equation constraints).

The composite node function (Eq. 22 in the paper) collapses the transformed GP prior into the observation model:

\[\tilde{\phi}(\tilde{\mathbf{y}}, x, \mathbf{v}, W, \boldsymbol{\theta}) = \exp\!\Bigl(-\tfrac{1}{2}\operatorname{tr}\bigl(W\,\tilde{A}_u(x, \boldsymbol{\theta})\bigr)\Bigr)\; \mathcal{N}\!\bigl(\tilde{\mathbf{y}} \mid \tilde{b}_u(x, \mathbf{v}, \boldsymbol{\theta}),\; W^{-1}\bigr) ,\]

with the transformed prior mean and residual covariance

\[\tilde{b}_u(x, \mathbf{v}, \boldsymbol{\theta}) = \tilde{m}(x) + \tilde{K}_{xu}(x, \boldsymbol{\theta})\, \bigl(\mathbf{v} - K_{uu}(\boldsymbol{\theta})^{-1}\mathbf{m}_u\bigr) \in \mathbb{R}^P ,\]

\[\tilde{A}_u(x, \boldsymbol{\theta}) = \tilde{K}_{xx'}(x, x, \boldsymbol{\theta}) - \tilde{K}_{xu}(x, \boldsymbol{\theta})\, K_{uu}(\boldsymbol{\theta})^{-1}\, \tilde{K}_{ux}(x, \boldsymbol{\theta}) \in \mathbb{R}^{P \times P} ,\]

where the transformed kernels are

SymbolDefinitionSize
$\tilde{m}(x)$$\mathcal{L}\,m(x)$$\mathbb{R}^P$
$\tilde{K}_{xu}(x, \boldsymbol{\theta})$$\mathcal{L}_1\,k_{\boldsymbol{\theta}}(x, X_u)$$\mathbb{R}^{P \times M}$
$\tilde{K}_{ux}(x, \boldsymbol{\theta})$$\mathcal{L}_2\,k_{\boldsymbol{\theta}}(X_u, x)$$\mathbb{R}^{M \times P}$
$\tilde{K}_{xx'}(x, x', \boldsymbol{\theta})$$\mathcal{L}_1 \mathcal{L}_2\,k_{\boldsymbol{\theta}}(x, x')$$\mathbb{R}^{P \times P}$
$K_{uu}(\boldsymbol{\theta})$$k_{\boldsymbol{\theta}}(X_u, X_u)$$\mathbb{R}^{M \times M}$

The inducing variables $\mathbf{v} = K_{uu}^{-1}\mathbf{u}$ remain in the latent (untransformed) function space. This decoupled design allows multiple dID-VSGP nodes with different linear operators to share a single set of inducing variables in the same graph.

The operator is configured via the operator keyword in get_UniSGPMeta (:grad for $P=D$ gradient observations, :joint_fn_grad for $P=1+D$ stacked function-value-and-gradient observations).

RxGP.UniSGP_dIDType
UniSGP_dID

Decoupled inter-domain variational sparse Gaussian process (dID-VSGP) factor node. Generalises UniSGP by applying an arbitrary deterministic linear operator $\mathcal{L}$ to the latent GP, so that observations live in the transformed space $\tilde{f}(x) = \mathcal{L} f(x) \in \mathbb{R}^P$.

The composite node function is:

\[\tilde{\phi}(\tilde{\mathbf{y}}, x, \mathbf{v}, W, \boldsymbol{\theta}) = \exp\!\Bigl(-\tfrac{1}{2}\operatorname{tr}\bigl(W\,\tilde{A}_u(x, \boldsymbol{\theta})\bigr)\Bigr)\; \mathcal{N}\!\bigl(\tilde{\mathbf{y}} \mid \tilde{b}_u(x, \mathbf{v}, \boldsymbol{\theta}),\; W^{-1}\bigr)\]

where $\tilde{b}_u = \tilde{m}(x) + \tilde{K}_{xu}(\mathbf{v} - K_{uu}^{-1}\mathbf{m}_u)$ and $\tilde{A}_u = \tilde{K}_{xx'} - \tilde{K}_{xu} K_{uu}^{-1} \tilde{K}_{ux}$ with transformed kernels $\tilde{K}_{xu} = \mathcal{L}_1 k(x, X_u)$, etc. Inducing variables $\mathbf{v}$ remain in the latent (untransformed) space.

Edges: [out, in, v, Wg, θ] — output, input, transformed inducing variable, Wishart noise precision, kernel hyperparameters.

source

Edges:

EdgeSymbolTypeDescription
OutputoutℝᴾObserved gradient (or stacked value + gradient)
InputinℝᴰInput location
Inducing variablevℝᴹTransformed inducing variable
Noise precisionWgℝᴾˣᴾWishart-distributed precision matrix for gradient noise
HyperparametersθℝᵈKernel hyperparameters

Message passing rules — UniSGP_dID

EdgeOutgoing messageSummary
outNormalMeanPrecision or MvNormalMeanPrecisionPredictive mean in the operator-transformed output space
inContinuousUnivariateLogPdf or ContinuousMultivariateLogPdfBackward message for input
vBufferUniSGP{MvNormalWeightedMeanPrecision}Inducing variable update
WgWishartFastWishart update for the gradient noise precision
θContinuousUnivariateLogPdf or ContinuousMultivariateLogPdfLog-pdf for hyperparameters

Multivariate sparse GP node

The MultiSGP node implements a multivariate variational sparse Gaussian process (VSGP) factor for vector-valued observations $\mathbf{y} \in \mathbb{R}^D$. The multi-output structure is constructed via the intrinsic coregionalization model (ICM) with the coregionalization matrix $C_c = I_D$, giving the matrix-valued kernel $\mathcal{K}(\mathbf{x}, \mathbf{x}') = C_c \otimes k_{\boldsymbol{\theta}}(\mathbf{x}, \mathbf{x}')$.

The composite node function collapses the GP prior into the observation model:

\[f_{\mathrm{SGP}}(\mathbf{y}, \mathbf{x}, \mathbf{v}, W, \boldsymbol{\theta}) = \exp\!\Bigl(-\tfrac{1}{2}\operatorname{tr}(W\, A_{\mathbf{x},\boldsymbol{\theta}})\Bigr)\; \mathcal{N}\!\bigl(\mathbf{y} \mid B_{\mathbf{x},\boldsymbol{\theta}}\,\mathbf{v},\; W^{-1}\bigr)\]

with the Kronecker-structured projection and residual covariance

\[B_{\mathbf{x},\boldsymbol{\theta}} = C_c \otimes k_{\boldsymbol{\theta}}(\mathbf{x}, X_u) \in \mathbb{R}^{D \times DM},\]

\[A_{\mathbf{x},\boldsymbol{\theta}} = C_c \otimes k_{\boldsymbol{\theta}}(\mathbf{x}, \mathbf{x}) - B_{\mathbf{x},\boldsymbol{\theta}}\, K_u^{-1}\, B_{\mathbf{x},\boldsymbol{\theta}}^\top \in \mathbb{R}^{D \times D},\]

where $K_u = C_c \otimes k_{\boldsymbol{\theta}}(X_u, X_u) \in \mathbb{R}^{DM \times DM}$ and $\mathbf{v} = K_u^{-1}\mathbf{u} \in \mathbb{R}^{DM}$. Computational complexity is $\mathcal{O}(DNM^2)$.

RxGP.MultiSGPType
MultiSGP

Multivariate variational sparse Gaussian process (VSGP) factor node for vector-valued observations $\mathbf{y} \in \mathbb{R}^D$. The multi-output structure is built from the intrinsic coregionalization model (ICM) with coregionalization matrix $C_c = I_D$, so that the matrix-valued kernel is $\mathcal{K}(\mathbf{x}, \mathbf{x}') = C_c \otimes k_{\boldsymbol{\theta}}(\mathbf{x}, \mathbf{x}')$.

The composite node function collapses the GP prior into the observation model:

\[f_{\mathrm{SGP}}(\mathbf{y}, \mathbf{x}, \mathbf{v}, W, \boldsymbol{\theta}) = \exp\!\Bigl(-\tfrac{1}{2}\operatorname{tr}(W\, A_{\mathbf{x},\boldsymbol{\theta}})\Bigr)\; \mathcal{N}\!\bigl(\mathbf{y} \mid B_{\mathbf{x},\boldsymbol{\theta}}\,\mathbf{v},\; W^{-1}\bigr)\]

where

\[B_{\mathbf{x},\boldsymbol{\theta}} = C_c \otimes k_{\boldsymbol{\theta}}(\mathbf{x}, X_u) \in \mathbb{R}^{D \times DM},\]

\[A_{\mathbf{x},\boldsymbol{\theta}} = C_c \otimes k_{\boldsymbol{\theta}}(\mathbf{x}, \mathbf{x}) - B_{\mathbf{x},\boldsymbol{\theta}}\, K_u^{-1}\, B_{\mathbf{x},\boldsymbol{\theta}}^\top \in \mathbb{R}^{D \times D},\]

with $K_u = C_c \otimes k_{\boldsymbol{\theta}}(X_u, X_u)$ and $\mathbf{v} = K_u^{-1}\mathbf{u} \in \mathbb{R}^{DM}$. The computational complexity is $\mathcal{O}(DNM^2)$.

Edges: [out, in, v, w, θ] — output, input, stacked transformed inducing variables, Wishart noise precision, kernel hyperparameters.

source

Edges:

EdgeSymbolTypeDescription
OutputoutℝᴰObserved vector output
InputinℝᴰˣInput location
Inducing variablevℝᴰᴹStacked transformed inducing variables $K_u^{-1}\mathbf{u}$
Noise precisionwℝᴰˣᴰWishart-distributed noise precision matrix
HyperparametersθℝᵈKernel hyperparameters

Message passing rules — MultiSGP

EdgeOutgoing messageSummary
outMvNormalMeanPrecisionPredictive mean via Kronecker-structured projection
inContinuousUnivariateLogPdf or ContinuousMultivariateLogPdfBackward message for input
vMvNormalWeightedMeanPrecisionInducing variable update with Kronecker precision
wWishartWishart update for the noise precision
θContinuousMultivariateLogPdfLog-pdf for hyperparameters

Average energy

Each node also defines an @average_energy method, used to evaluate the variational free energy (ELBO) contribution of the GP factor during inference. These are computed automatically by the ReactiveMP engine — no user action is required.

Node type traits

The @node macro automatically registers each node with ReactiveMP's type system.