runlmc.models.gpy_lmc module

class runlmc.models.gpy_lmc.GPyLMC(Xs, Ys, kernels, ranks, name='GPyLMC', sparse=0)[source]

Bases: runlmc.models.multigp.MultiGP

This wraps GPy for the Gaussian Process model for multioutput regression under a Linear Model of Coregionalization.

This performs the inversion-based cubic-time algorithm.

Uses the Gaussian likelihood. See runlmc.lmc.functional_kernel for the explicit LMC formula.

The DTCVAR algorithm (the sparse parameter) is based on Efficient Multioutput Gaussian Processes through Variational Inducing Kernels by Álvarez et al. 2010.

Parameters:
  • Xs – input observations, should be a list of numpy arrays, where each numpy array is a design matrix for the inputs to output \(i\). If the \(i\)-th input has \(n_i\) data points, then this matrix can be \(n_i\) or \(n_i\times P\) shape for input dimension \(P\), with the former re-interpreted as \(P=1\).
  • Ys – output observations, this must be a list of one-dimensional numpy arrays, matching up with the number of rows in Xs.
  • kernels – a list of (stationary) kernels which constitute the terms of the LMC sums prior to coregionalization.
  • ranks (list of integer) – list of ranks for coregionalization factors
  • name (string) – model name
  • sparse – an integer. If 0, uses GPy.models.GPCoregionalizedRegression, the typical cholesky algorithm. If >0, then this determines the number of inducing points used by the DTCVAR algorithm in use GPy.models.SparseGPCoregionalizedRegression
log_likelihood()[source]

The log marginal likelihood of the model, \(p(\mathbf{y})\), this is the objective function of the model being optimised

optimize(**kwargs)[source]

Optimize the model using log_likelihood() with a gradient descent method that involves the priors.

kwargs are passed to the optimizer. See parameters for handled keywords.

Parameters:optimizer – A paramz.optimization.Optimizer. Pre-built ones available in runlmc.models.optimization.
parameters_changed()[source]

This method is called automatically when linked parameters change, which the may during the optimization process.

Classes should update their posterior information, log likelihood, and gradients when this happens, such that _raw_predict(), log_likelihood(), and gradient() are consistent with the new parameters.

predict(Xs)[source]

Predict the functions at the new points Xs.

Parameters:Xs – The points at which to make a prediction for each output. Should be empty if no output desired for a certain index. This is a list of numpy.ndarray for each output d, one-dimensional of size n_d each. Length of Xs should be equal to the number of outputs output_dim.
Returns:(mean, var):
mean: posterior mean, a list of length output_dim with
one-dimensional numpy arrays of length n_d at index d.

var: posterior variance, corresponding to each mean entry.

predict_quantiles(Xs, quantiles=(2.5, 97.5))[source]

Identical to predict, but returns quantiles instead of mean and variance according to the Gaussian likelihood.

Parameters:quantiles (tuple of doubles) – tuple of quantiles, default is (2.5, 97.5), which is the 95% interval; shouldn’t be 0 or 100
Returns:list of quantiles for each output’s input, as a numpy array, 2-D, the first axis corresponding to the input index and the second to the quantile index.