rxmc.predictive.gp_posterior_predictive#

rxmc.predictive.gp_posterior_predictive(kernel, theta, X_train, residuals, X_pred, *, train_noise_var=None, jitter=1e-10)[source]#

Posterior mean and covariance of a GP discrepancy at X_pred.

Conditions a zero-mean GP with covariance kernel (rebuilt at theta) on the observed residuals at X_train and returns its posterior at X_pred:

\[\bar f_* = K_{*t} (K_{tt} + N)^{-1} r, \qquad \mathrm{cov}_* = K_{**} - K_{*t} (K_{tt} + N)^{-1} K_{t*}\]

where N is the training-noise covariance.

Parameters:
  • kernel (sklearn-style kernel) – Object with clone_with_theta and __call__ (as for kernel_term()).

  • theta (array-like) – Kernel hyperparameters in sklearn log-theta space.

  • X_train, X_pred (array-like) – Training and prediction inputs (1-D promoted to a column).

  • residuals (array-like, shape (n_train,)) – Observed minus model-mean at X_train.

  • train_noise_var (float, array-like, or matrix, optional) – Training-noise variance: scalar (var*I), per-point vector (diag), or full covariance. Defaults to none.

  • jitter (float, optional) – Diagonal nugget added to the training covariance for stability.

Returns:

  • mean (np.ndarray, shape (n_pred,))

  • cov (np.ndarray, shape (n_pred, n_pred))