runlmc.models.gpy_lmc module¶
-
class
runlmc.models.gpy_lmc.GPyLMC(Xs, Ys, kernels, ranks, name='GPyLMC', sparse=0)[source]¶ Bases:
runlmc.models.multigp.MultiGPThis 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_kernelfor 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 useGPy.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 inrunlmc.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(), andgradient()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 listofnumpy.ndarrayfor each output d, one-dimensional of size n_d each. Length of Xs should be equal to the number of outputsoutput_dim.Returns: (mean, var): - mean: posterior mean, a list of length
output_dimwith - one-dimensional numpy arrays of length n_d at index d.
var: posterior variance, corresponding to each mean entry.
- mean: posterior mean, a list of length
-
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.