SepiaPredict¶
The SepiaPredict class is used to obtain predictions from the model based on MCMC samples. Three types of predictions are possible:
SepiaEmulatorPrediction: predictions from the emulator portion of the model
SepiaXvalEmulatorPrediction: cross-validated predictions from the emulator
SepiaFullPrediction: predictions from the full model (including discrepancy and observation noise)
The SepiaPredict classes handle transformation from u/w/v to the original output space.
- class sepia.SepiaPrediction(x_pred=None, samples=None, model=None, t_pred=None, addResidVar=False, storeRlz=True, storeMuSigma=False, do_call=True)¶
Base class inherited for predictions. Contains:
- Variables
model (sepia.SepiaModel) – SepiaModel instance
xpred (numpy.ndarray) – x values for which to predict, shape (npred, p) matrix, on original untransformed scale
t_pred (numpy.ndarray/NoneType) – t values for which to predict, shape (npred, q) matrix, optional for full model (if not provided, theta values from posterior samples will be used) but required for emulator.
samples (dict) – from SepiaModel.get_samples()
addResidVar (bool) – add the posterior residual variability to the samples?
storeRlz (bool) – make and store a process realizations for each x_pred / sample combination?
storeMuSigma (bool) – store the mean and sigma for the GP posterior for each x_pred / sample combination?
do_call (bool) – call wPred/uvPred upon initialization?
w (numpy.ndarray/NoneType) – simulation predictions on PCA weight space, shape (#samples, #x_pred, pu)
u (numpy.ndarray/NoneType) – observation predictions on PCA weight space, shape (#samples, #x_pred, pu)
v (numpy.ndarray/NoneType) – observation predictions on D weight space, shape (#samples, #x_pred, pv)
mu (numpy.ndarray/NoneType) – posterior mean, shape (#samples, #x_pred)
sigma (numpy.ndarray/NoneType) – posterior sigma, shape (#samples, #x_pred, #x_pred)
- class sepia.SepiaXvalEmulatorPrediction(leave_out_inds=None, model=None, *args, **kwrds)¶
Cross-validated predictions from the emulator.
Instantiate SepiaXvalEmulatorPrediction object.
- Parameters
leave_out_inds (list/NoneType) – optional, list of lists of indices to leave out in each fold; defaults to leave-one-out
x_pred (numpy.ndarray) – x values for which to predict, shape (npred, p) matrix, on original untransformed scale
samples (dict) – from SepiaModel.get_samples()
model (sepia.SepiaModel) – the SepiaModel object
t_pred (numpy.ndarray) – t values for which to predict, shape (npred, q) matrix, required.
addResidVar (bool) – add the posterior residual variability to the samples?
storeRlz (bool) – make and store a process realizations for each x_pred / sample combination?
storeMuSigma (bool) – store the mean and sigma for the GP posterior for each x_pred / sample combination?
do_call (bool) – call wPred upon initialization?
- Raises
TypeError – if inputs are not expected types
ValueError – if inputs are not expected shapes
- class sepia.SepiaEmulatorPrediction(*args, **kwrds)¶
Make predictions of the emulator (‘eta’) component of the model. This functions with an emulator-only model or a full model, but predicts the posterior simulation estimates. Predictions are performed on init and stored in the object for access methods.
Instantiate SepiaEmulatorPrediction object.
- Parameters
x_pred (numpy.ndarray) – x values for which to predict, shape (npred, p) matrix, on original untransformed scale
samples (dict) – from SepiaModel.get_samples()
model (sepia.SepiaModel) – the SepiaModel object
t_pred (numpy.ndarray) – t values for which to predict, shape (npred, q) matrix, required.
addResidVar (bool) – add the posterior residual variability to the samples?
storeRlz (bool) – make and store a process realizations for each x_pred / sample combination?
storeMuSigma (bool) – store the mean and sigma for the GP posterior for each x_pred / sample combination?
do_call (bool) – call wPred upon initialization?
- Raises
TypeError – if inputs are not expected types
ValueError – if inputs are not expected shapes
- get_mu_sigma()¶
Returns the stored (if requested on init) mean (vector) and sigma (matrix) of the posterior process for each sample
- Returns
tuple: posterior mean (#samples x #x_pred), sigma (#samples x #x_pred x #x_pred x )
- get_w()¶
Returns predictions that were made on init in PCA weight space.
- Returns
predictions of w, (#samples x #x_pred x pu) numpy.ndarray
- get_y(std=False)¶
Project w through the K basis to provide predictions of y on native (or standardized) scale. (standardized refers to the mean=0 and sd=1 standardization process in model setup).
- Parameters
std (bool) – return standardized (True) or native (default, False) scaling of predictions
- Returns
predictions of y, (#samples x #x_pred x py) tensor
- class sepia.SepiaFullPrediction(mode='Sep', *args, **kwrds)¶
Make predictions of the full model: both emulator (‘eta’) and discrepancy (‘delta’) == (u,v) Predictions are performed on init and stored in the object for access by methods.
Instantiate SepiaFullPrediction object.
- Parameters
x_pred (numpy.ndarray) – x values for which to predict, shape (npred, p) matrix, on original untransformed scale
samples (dict) – from SepiaModel.get_samples()
model (sepia.SepiaModel) – the SepiaModel object
t_pred (numpy.ndarray) – t values for which to predict, shape (npred, q) matrix, optional (can take from theta samples).
addResidVar (bool) – add the posterior residual variability to the samples?
storeRlz (bool) – make and store a process realizations for each x_pred / sample combination?
storeMuSigma (bool) – store the mean and sigma for the GP posterior for each x_pred / sample combination?
- Raises
TypeError – if inputs are not expected types
ValueError – if inputs are not expected shapes
- get_discrepancy(as_obs=False, std=False, obs_ref=0)¶
return Dsim*v to provide predictions of discrepancy on the native scale at sim locations. (native refers to not the sd=1 standardization process in model setup)
- Parameters
as_obs (bool) – provide discrepancy predictions at obs locations (defaults to sim locations)
std (bool) – provide discrepancy predictions on standardized scale (defaults to native scale)
obs_ref (int) – if this is a ragged_obs problem, selects the reference observation index to use for transformation parameters; default index 0
- Returns
predictions of native discrepancy, (#samples x #x_pred x py_sim(or py_obs)) or (#samples x py_sim(or py_obs)) if ragged and obs_ref is specified
- get_mu_sigma()¶
Returns the stored (if requested on init) mean (vector) and sigma (matrix) of the posterior process for each sample
- Returns
tuple: posterior mean (#samples x #x_pred), sigma (#samples x #x_pred x #x_pred x )
- get_u_v()¶
Returns predictions that were made on init
- Returns
tuple: predictions of u (#samples x #x_pred x pu) , v (#samples x #x_pred x pv)
- get_yobs(as_obs=False, std=False, obs_ref=0)¶
return y=Ksim*u+Dsim*v to provide predictions of y on the native scale at sim locations. (native refers to not the mean=0 and sd=1 standardization process in model setup)
- Parameters
as_obs (bool) – provide discrepancy predictions at obs locations (defaults to sim locations)
std (bool) – provide discrepancy predictions on standardized scale (defaults to native scale)
obs_ref (int) – if this is a ragged_obs problem, selects the reference observation index to use for transformation parameters; default index 0
- Returns
predictions of native y (Emulator+Discrepancy), (#samples x #x_pred x py_sim(or py_obs)) or (#samples x py_sim(or py_obs)) if ragged and obs_ref is specified
- get_ysim(as_obs=False, std=False, obs_ref=0)¶
Project u through the K basis to provide predictions of ysim on the native scale. (native refers to not the mean=0 and sd=1 standardization process in model setup)
- Parameters
as_obs (bool) – provide ysim predictions at obs locations (defaults to sim locations)
std (bool) – provide ysim predictions on standardized scale (defaults to native scale)
obs_ref (int) – if this is a ragged_obs problem, selects the reference observation index to use for transformation parameters; default index 0
- Returns
predictions of native ysim, (#samples x #x_pred x py_sim(or py_obs)) or (#samples x py_sim(or py_obs)) if ragged and obs_ref is specified