Gaussian Processes on Graphs

The module implements methods to approximate Gaussian processes using Sparse Approximations. The functions of immediate use to practitioners are gp_graph_exp_quad_cov_lpdf(vector, vector, array [] vector, real, real, array [,] int) to evaluate the likelihood of a one-dimensional signal and gp_inv_graph_exp_quad_cov(vector, vector, array [] vector, real, real, array[,] int) to construct a non-centered parameterization using white noise. Analogues are implemented for Matérn kernels with \(\nu=3/2\) and \(\nu=5/2\).

Function Reference

array [] int out_degrees(int n, array [,] int edge_index)

Evaluate the out-degree of nodes in the directed acyclic graph induced by edge_index. The node labels of successors must be ordered and predecessors must have index less than successors.

Parameters
  • n – Number of nodes.

  • edge_index – Directed edges as a tuple of predecessor and successor indices, i.e., the node labelled edge_index[1, i] is the predecessor of the node labelled edge_index[2, i].

Returns

Out-degree of each node.

vector gp_graph_conditional_loc_scale(vector y, array [] vector x, int kernel, real sigma, real length_scale, int node, array [] int predecessors, real epsilon)

Evaluate the location and scale for a node given its predecessors, assuming zero mean.

Parameters
  • y – State of each node.

  • x – Array of k + 1 locations in p dimensions.

  • kernel – Kernel to use (0 for squared exponential, 1 for Matern 3/2, 2 for Matern 5/2).

  • sigma – Marginal scale of the kernel.

  • length_scale – Correlation length of the kernel.

  • predecessors – Labels of k predecessors of the target node.

  • epsilon – Nugget variance for numerical stability.

Returns

Location and scale parameters for the distribution of the node given its predecessors.

real gp_graph_lpdf(vector y, vector loc, array [] vector x, int kernel, real sigma, real length_scale, array [,] int edges, array [] int degrees, real epsilon)

Evaluate the log probability of a graph Gaussian process.

Parameters
  • y – State of each node.

  • loc – Mean of each node.

  • x – Position of each node.

  • kernel – Kernel to use (0 for squared exponential, 1 for Matern 3/2, 2 for Matern 5/2).

  • sigma – Marginal scale of the kernel.

  • length_scale – Correlation length of the kernel.

  • edges – Directed edges between nodes constituting a directed acyclic graph. Edges are stored as a matrix with shape (2, m), where m is the number of edges. The first row comprises parents of children in the second row. The first row can have arbitrary order, but the second row must be sorted.

  • degrees – Out-degree of each node.

  • epsilon – Nugget variance for numerical stability.

Returns

Log probability of the graph Gaussian process.

real gp_graph_lpdf(vector y, vector loc, array [] vector x, int kernel, real sigma, real length_scale, array [,] int edges)

Evaluate the log probability of a graph Gaussian process.

Parameters
  • y – State of each node.

  • loc – Mean of each node.

  • x – Position of each node.

  • kernel – Kernel to use (0 for squared exponential, 1 for Matern 3/2, 2 for Matern 5/2).

  • sigma – Marginal scale of the kernel.

  • length_scale – Correlation length of the kernel.

  • edges – Directed edges between nodes constituting a directed acyclic graph. Edges are stored as a matrix with shape (2, m), where m is the number of edges. The first row comprises parents of children in the second row. The first row can have arbitrary order, but the second row must be sorted.

Returns

Log probability of the graph Gaussian process.

vector gp_inv_graph(vector z, vector loc, array [] vector x, int kernel, real sigma, real length_scale, array [,] int edges, array [] int degrees, real epsilon)

Transform white noise to a sample from a graph Gaussian process

Parameters
  • z – White noise for each node.

  • loc – Mean of each node.

  • x – Position of each node.

  • kernel – Kernel to use (0 for squared exponential, 1 for Matern 3/2, 2 for Matern 5/2).

  • sigma – Marginal scale of the kernel.

  • length_scale – Correlation length of the kernel.

  • edges – Directed edges between nodes constituting a directed acyclic graph. Edges are stored as a matrix with shape (2, m), where m is the number of edges. The first row comprises parents of children in the second row. The first row can have arbitrary order, but the second row must be sorted.

  • degrees – Out-degree of each node.

  • epsilon – Nugget variance for numerical stability.

Returns

Sample from the Graph gaussian process.

vector gp_inv_graph(vector z, vector loc, array [] vector x, int kernel, real sigma, real length_scale, array [,] int edges)

Transform white noise to a sample from a graph Gaussian process

Parameters
  • z – White noise for each node.

  • loc – Mean of each node.

  • x – Position of each node.

  • kernel – Kernel to use (0 for squared exponential, 1 for Matern 3/2, 2 for Matern 5/2).

  • sigma – Marginal scale of the kernel.

  • length_scale – Correlation length of the kernel.

  • edges – Directed edges between nodes constituting a directed acyclic graph. Edges are stored as a matrix with shape (2, m), where m is the number of edges. The first row comprises parents of children in the second row. The first row can have arbitrary order, but the second row must be sorted.

Returns

Sample from the Graph gaussian process.

real gp_graph_exp_quad_cov_lpdf(vector y, vector loc, array [] vector x, real sigma, real length_scale, array [,] int edges, array [] int degrees, real epsilon)

Evaluate the log probability of a graph Gaussian with squared exponential kernel.

Parameters
  • y – State of each node.

  • loc – Mean of each node.

  • x – Position of each node.

  • sigma – Marginal scale of the kernel.

  • length_scale – Correlation length of the kernel.

  • edges – Directed edges between nodes constituting a directed acyclic graph. Edges are stored as a matrix with shape (2, m), where m is the number of edges. The first row comprises parents of children in the second row. The first row can have arbitrary order, but the second row must be sorted.

  • degrees – Out-degree of each node.

  • epsilon – Nugget variance for numerical stability.

Returns

Log probability of the graph Gaussian process.

real gp_graph_exp_quad_cov_lpdf(vector y, vector loc, array [] vector x, real sigma, real length_scale, array [,] int edges)

Evaluate the log probability of a graph Gaussian with squared exponential kernel.

Parameters
  • y – State of each node.

  • loc – Mean of each node.

  • x – Position of each node.

  • sigma – Marginal scale of the kernel.

  • length_scale – Correlation length of the kernel.

  • edges – Directed edges between nodes constituting a directed acyclic graph. Edges are stored as a matrix with shape (2, m), where m is the number of edges. The first row comprises parents of children in the second row. The first row can have arbitrary order, but the second row must be sorted.

Returns

Log probability of the graph Gaussian process.

vector gp_inv_graph_exp_quad_cov(vector z, vector loc, array [] vector x, real sigma, real length_scale, array [,] int edges, array [] int degrees, real epsilon)

Transform white noise to a sample from a graph Gaussian process with squared exponential kernel.

Parameters
  • z – White noise for each node.

  • loc – Mean of each node.

  • x – Position of each node.

  • sigma – Marginal scale of the kernel.

  • length_scale – Correlation length of the kernel.

  • edges – Directed edges between nodes constituting a directed acyclic graph. Edges are stored as a matrix with shape (2, m), where m is the number of edges. The first row comprises parents of children in the second row. The first row can have arbitrary order, but the second row must be sorted.

  • degrees – Out-degree of each node.

  • epsilon – Nugget variance for numerical stability.

Returns

Sample from the Graph gaussian process.

vector gp_inv_graph_exp_quad_cov(vector z, vector loc, array [] vector x, real sigma, real length_scale, array [,] int edges)

Transform white noise to a sample from a graph Gaussian process with squared exponential kernel.

Parameters
  • z – White noise for each node.

  • loc – Mean of each node.

  • x – Position of each node.

  • sigma – Marginal scale of the kernel.

  • length_scale – Correlation length of the kernel.

  • edges – Directed edges between nodes constituting a directed acyclic graph. Edges are stored as a matrix with shape (2, m), where m is the number of edges. The first row comprises parents of children in the second row. The first row can have arbitrary order, but the second row must be sorted.

Returns

Sample from the Graph gaussian process.

real gp_graph_matern32_cov_lpdf(vector y, vector loc, array [] vector x, real sigma, real length_scale, array [,] int edges, array [] int degrees, real epsilon)

Evaluate the log probability of a graph Gaussian with Matern 3 / 2 kernel.

Parameters
  • y – State of each node.

  • loc – Mean of each node.

  • x – Position of each node.

  • sigma – Marginal scale of the kernel.

  • length_scale – Correlation length of the kernel.

  • edges – Directed edges between nodes constituting a directed acyclic graph. Edges are stored as a matrix with shape (2, m), where m is the number of edges. The first row comprises parents of children in the second row. The first row can have arbitrary order, but the second row must be sorted.

  • degrees – Out-degree of each node.

  • epsilon – Nugget variance for numerical stability.

Returns

Log probability of the graph Gaussian process.

real gp_graph_matern32_cov_lpdf(vector y, vector loc, array [] vector x, real sigma, real length_scale, array [,] int edges)

Evaluate the log probability of a graph Gaussian with Matern 3 / 2 kernel.

Parameters
  • y – State of each node.

  • loc – Mean of each node.

  • x – Position of each node.

  • sigma – Marginal scale of the kernel.

  • length_scale – Correlation length of the kernel.

  • edges – Directed edges between nodes constituting a directed acyclic graph. Edges are stored as a matrix with shape (2, m), where m is the number of edges. The first row comprises parents of children in the second row. The first row can have arbitrary order, but the second row must be sorted.

Returns

Log probability of the graph Gaussian process.

vector gp_inv_graph_matern32_cov(vector z, vector loc, array [] vector x, real sigma, real length_scale, array [,] int edges, array [] int degrees, real epsilon)

Transform white noise to a sample from a graph Gaussian process with Matern 3 / 2 kernel.

Parameters
  • z – White noise for each node.

  • loc – Mean of each node.

  • x – Position of each node.

  • sigma – Marginal scale of the kernel.

  • length_scale – Correlation length of the kernel.

  • edges – Directed edges between nodes constituting a directed acyclic graph. Edges are stored as a matrix with shape (2, m), where m is the number of edges. The first row comprises parents of children in the second row. The first row can have arbitrary order, but the second row must be sorted.

  • degrees – Out-degree of each node.

  • epsilon – Nugget variance for numerical stability.

Returns

Sample from the Graph gaussian process.

vector gp_inv_graph_matern32_cov(vector z, vector loc, array [] vector x, real sigma, real length_scale, array [,] int edges)

Transform white noise to a sample from a graph Gaussian process with Matern 3 / 2 kernel.

Parameters
  • z – White noise for each node.

  • loc – Mean of each node.

  • x – Position of each node.

  • sigma – Marginal scale of the kernel.

  • length_scale – Correlation length of the kernel.

  • edges – Directed edges between nodes constituting a directed acyclic graph. Edges are stored as a matrix with shape (2, m), where m is the number of edges. The first row comprises parents of children in the second row. The first row can have arbitrary order, but the second row must be sorted.

Returns

Sample from the Graph gaussian process.

real gp_graph_matern52_cov_lpdf(vector y, vector loc, array [] vector x, real sigma, real length_scale, array [,] int edges, array [] int degrees, real epsilon)

Evaluate the log probability of a graph Gaussian with Matern 5 / 2 kernel.

Parameters
  • y – State of each node.

  • loc – Mean of each node.

  • x – Position of each node.

  • sigma – Marginal scale of the kernel.

  • length_scale – Correlation length of the kernel.

  • edges – Directed edges between nodes constituting a directed acyclic graph. Edges are stored as a matrix with shape (2, m), where m is the number of edges. The first row comprises parents of children in the second row. The first row can have arbitrary order, but the second row must be sorted.

  • degrees – Out-degree of each node.

  • epsilon – Nugget variance for numerical stability.

Returns

Log probability of the graph Gaussian process.

real gp_graph_matern52_cov_lpdf(vector y, vector loc, array [] vector x, real sigma, real length_scale, array [,] int edges)

Evaluate the log probability of a graph Gaussian with Matern 5 / 2 kernel.

Parameters
  • y – State of each node.

  • loc – Mean of each node.

  • x – Position of each node.

  • sigma – Marginal scale of the kernel.

  • length_scale – Correlation length of the kernel.

  • edges – Directed edges between nodes constituting a directed acyclic graph. Edges are stored as a matrix with shape (2, m), where m is the number of edges. The first row comprises parents of children in the second row. The first row can have arbitrary order, but the second row must be sorted.

Returns

Log probability of the graph Gaussian process.

vector gp_inv_graph_matern52_cov(vector z, vector loc, array [] vector x, real sigma, real length_scale, array [,] int edges, array [] int degrees, real epsilon)

Transform white noise to a sample from a graph Gaussian process with Matern 5 / 2 kernel.

Parameters
  • z – White noise for each node.

  • loc – Mean of each node.

  • x – Position of each node.

  • sigma – Marginal scale of the kernel.

  • length_scale – Correlation length of the kernel.

  • edges – Directed edges between nodes constituting a directed acyclic graph. Edges are stored as a matrix with shape (2, m), where m is the number of edges. The first row comprises parents of children in the second row. The first row can have arbitrary order, but the second row must be sorted.

  • degrees – Out-degree of each node.

  • epsilon – Nugget variance for numerical stability.

Returns

Sample from the Graph gaussian process.

vector gp_inv_graph_matern52_cov(vector z, vector loc, array [] vector x, real sigma, real length_scale, array [,] int edges)

Transform white noise to a sample from a graph Gaussian process with Matern 5 / 2 kernel.

Parameters
  • z – White noise for each node.

  • loc – Mean of each node.

  • x – Position of each node.

  • sigma – Marginal scale of the kernel.

  • length_scale – Correlation length of the kernel.

  • edges – Directed edges between nodes constituting a directed acyclic graph. Edges are stored as a matrix with shape (2, m), where m is the number of edges. The first row comprises parents of children in the second row. The first row can have arbitrary order, but the second row must be sorted.

Returns

Sample from the Graph gaussian process.