bebi103.gp.posterior_mean_cov
- bebi103.gp.posterior_mean_cov(X, y, Xstar, sigma, kernel=<function se_kernel>, include_deriv=False, delta=1e-08, **kernel_hyperparams)
Compute the posterior mean vector and covariance matrix for a posterior Gaussian process derived from a Normal likelihood and Gaussian process prior.
- Parameters
X (1D, shape (n,) or 2D array, shape (n, d)) – Array of n data points for which observations were made. If a 1D array, assume the points are one-dimensional. If a 2D array, assume the points are d-dimensional.
y (array, shape (n,)) – Measured data points.
Xstar (1D, shape (nstar,) or 2D array, shape (nstar, d)) – Array of nstar data points for posterior predictions are to be made. If a 1D array, assume the points are one-dimensional. If a 2D array, assume the points are d-dimensional.
sigma (float or array, shape (n,)) – Standard deviation for Normal likelihood. If a float, assumed to be homoscedastic for all points.
kernel (function, default se_kernel) – Kernel defining the Gaussian process. Must have call signature kernel(x1, x2, **kernel_hyperparams).
include_deriv (bool, default False) – If True, include first derivatives in mean vectors and covariances. If True, X and Xstar must both be 1D because multivariate gradients are not implemented.
delta (float, default 1e-8) – Small number, used to add to the diagonal of covariance matrices to ensure numerical positive definiteness.
**kernel_hyperparams (kwargs) – All additional kwargs are sent as kwargs to the kernel function.
- Returns
m (array, shape (nstar,)) – The mean function of the Gaussian process posterior evaluated at the points given by Xstar.
Sigma (array, shape (nstar, nstar) or (2*nstar, 2*nstar)) – Covariance matrix of the Gaussian process posterior evaluated at the points given by Xstar.
g (array, shape (nstar,)) – The derivative function of the Gaussian process posterior evaluated at the points given by Xstar. Only returned if include_deriv is True.
Sigma_g (array, shape (nstar, nstar)) – The covariance matrix for the derivative of the Gaussian process posterior evaluated at the points given by Xstar. Only returned if include_deriv is True.
Notes
must be used.