rxmc.predictive.total_predictive_band#
- rxmc.predictive.total_predictive_band(mean_fn, kernel, x_train, y_train, x_pred, draws, n_model_params, *, theta_cols=None, noise_std=0.0, train_noise_var=None, levels=(16, 84), n_draws=400, rng=None)[source]#
Data-space predictive band that propagates total uncertainty.
For each posterior draw
qit splits out the model parameters and the kernel log-theta, forms the residualy_train - mean_fn(x_train, *model_params), conditions the GP discrepancy atx_pred, and samples\[y_*^{(s)} = \mathrm{mean\_fn}(x_*) + \bar f_*^{(s)} + \mathcal N\!\big(0,\ \mathrm{var}_*^{(s)} + \sigma^2\big),\]returning the requested percentile band over the samples. Only the GP’s posterior variance is propagated per point (the off-diagonal posterior covariance is not used for the marginal band).
- Parameters:
mean_fn (callable) –
mean_fn(x, *model_params) -> yon a rawxarray (e.g. a model’s.yplotting helper).kernel (sklearn-style kernel) – The discrepancy kernel (as passed to
kernel_term()).x_train, y_train, x_pred (array-like) – Training inputs/outputs and the prediction grid.
draws (array-like, shape (n_samples, n_draw_cols)) – Posterior chain rows.
n_model_params (int) – Number of leading model parameters in each draw (consumed by
mean_fn).theta_cols (array-like of int, optional) – Column indices selecting the kernel log-theta within each draw row, in
kernel.thetaorder. WhenNone(default) the kernel theta is taken as the trailing columnsq[n_model_params:]and the row width is validated againstlen(kernel.theta). Pass explicit columns when the draw also carries other covariance/likelihood nuisances.noise_std (float, optional) – Observation noise std-dev, used both to condition the GP and as the prediction-point noise (overridden for conditioning by
train_noise_varif given).train_noise_var (float or array-like, optional) – Training-noise covariance for conditioning (defaults to
noise_std**2).levels (sequence of float, optional) – Percentile levels for the returned band.
n_draws (int, optional) – Number of posterior rows to subsample (if the chain is longer).
rng (np.random.Generator, optional)
- Returns:
np.ndarray, shape (len(levels), len(x_pred))
- Raises:
ValueError – If the kernel-theta selection does not have
len(kernel.theta)columns.