SepiaPlot

SepiaPlot has visualization utilities which usually accept a SepiaData object.

plot_data(data) # Plot data plot_K_basis(data) # Show K basis functions plot_K_weights(data) # Show histograms of projections of data onto K basis functions plot_u_w_pairs(data) # Show pairs plots of projections of data onto K basis functions plot_K_residuals(data) # Show residuals after projection onto K basi theta_pairs(samples) # Show pairs plots of thetas mcmc_trace(samples) # Show trace plots of mcmc for all parameters param_stats(samples) # Show summary statistics for mcmc rho_box_plots(model) # Show boxplots of transformed GP lengthscale parameters plot_acf(model,nlags) # Show autocorrelation function for thetas pca_projected_data(data) # Compare data and PCA representations cv_pred_vs_true(model,cvpred) # Compare true and predicted PC weights from cross validation prediction object

sepia.SepiaPlot.cv_predicted_vs_true(model, cvpred, figsize=(10, 10))

Plot emulator predicted PC weight vs. true PC weights to validate

Parameters
sepia.SepiaPlot.mcmc_trace(samples_dict, theta_names=None, start=0, end=None, n_to_plot=500, by_group=True, max_print=10, save=None)

Create trace plot of MCMC samples.

Parameters
  • samples_dict (dict) – samples from model.get_samples()

  • theta_names (list/NoneType) – list of string names for thetas, optional (None will use default names)

  • start (int) – where to start plotting traces (sample index)

  • end (int/NoneType) – where to end plotting traces (sample index)

  • n_to_plot (int) – how many samples to show

  • by_group (bool) – group params of the same name onto one axis?

  • max_print (int) – maximum number of traces to plot

  • save (str) – file name to save plot

Returns

matplotlib figure

sepia.SepiaPlot.param_stats(samples_dict, theta_names=None, q1=0.05, q2=0.95, digits=4)

Compute statistics on the samples.

Parameters
  • samples_dict (dict) – samples from model.get_samples()

  • theta_names (list/NoneType) – list of string names for thetas, optional (None will use default names)

  • q1 (float) – lower quantile in [0, 1]

  • q2 (float) – upper quantile in [0, 1]

  • digits (int) – how many digits to show in output

Returns

pandas DataFrame containing statistics

sepia.SepiaPlot.pca_projected_data(data)

Plots observed and simulated data, along with PCA representations of that data.

Parameters

data (SepiaData) – SepiaData object

sepia.SepiaPlot.plot_K_basis(data, max_plots=4, obs=True)

Plots K basis elements for both sim and obs indices (if applicable). Only applies to multivariate-output models.

TODO: Lamy should be 1/Sigy_std

Parameters
  • data (SepiaData) – SepiaData object

  • max_plots (int) – maximum number of principal components to plot

Returns

tuple containing matplotlib figure objects: (fig_sim, fig_obs) or just fig_sim if no observed data is present

sepia.SepiaPlot.plot_K_residuals(data)

Plots residuals after projection to K basis. Only applies to multivariate-output models.

Parameters

data (SepiaData) – SepiaData object

Returns

tuple containing matplotlib figure objects: (fig_u, fig_v) or just fig_noD if no discrepancy is specified

sepia.SepiaPlot.plot_K_weights(data, max_u_plot=5)

Plots K basis weights for both sim and obs data (if applicable). Only applies to multivariate-output models.

TODO: Lamy should be 1/Sigy_std

Parameters
  • data (SepiaData) – SepiaData object

  • max_u_plot (int) – max number of u’s for which to plot vertical line over histogram of w’s

Returns

tuple containing matplotlib figure objects: (fig_uw, fig_v) or just fig_uw if no discrepancy is specified

sepia.SepiaPlot.plot_acf(model, nlags, nburn=0, alpha=0.05, save=None)

Plot autocorrelation function for all parameters theta.

Parameters
  • model (sepia.SepiaModel) – SepiaModel object

  • nlags (int) – how many lags to compute/plot

  • nburn (int) – how many samples to burn

  • alpha (float) – confidence level for acf significance line (0,1)

  • save (str) – file name to save figure

Returns

matplotlib figure

sepia.SepiaPlot.plot_data(data, which_x=None, x_min=None, x_max=None, y_min=None, y_max=None, n_neighbors=3, max_sims=50, save=None)

Plots observed data and simulation runs on the same axis with n_neighbors nearest simulations in x-space. Only applies to multivariate-output models with both simulation and observed data.

Parameters
  • data (SepiaData) – SepiaData object

  • which_x (list/NoneType) – optionally sets which x_obs indices to plot

  • x_min (float) – sets x lower limit on plot

  • x_max (float) – sets x upper limit on plot

  • y_min (float) – sets y lower limit on plot

  • y_max (float) – sets y upper limit on plot

  • n_neighbors (int) – sets number of nearest simulations to highlight

  • max_sims (int) – sets maximum number of simulation runs to plot

Return matplotlib figure fig

figure object of plot

sepia.SepiaPlot.plot_u_w_pairs(data, max_plots=5, save=False)

Plots principal component basis weights for both sim and obs data (if applicable). Only applies to multivariate-output models.

Parameters
  • data (SepiaData) – SepiaData object

  • max_plots (int) – max number of principal components to plot

Returns

matplotlib figure fig_g: seaborn pairs figure

sepia.SepiaPlot.rho_box_plots(model, labels=None)

Show rho box plots. (Rho are the transformed betaU parameters, corresponding to GP lengthscales)

Parameters
  • model (sepia.SepiaModel) – SepiaModel object

  • labels (list/NoneType) – optional labels to use for box plot

Returns

matplotlib figure

sepia.SepiaPlot.theta_pairs(samples_dict, design_names=None, native=False, lims=None, theta_ref=None, save=None)

Create pairs plot of sampled thetas.

Parameters
  • samples_dict (dict) – samples from model.get_samples()

  • design_names (list/NoneType) – list of string names for thetas, optional (None will use default names)

  • native (bool) – put theta on native scale? (note: you likely want to pass lims in this case)

  • lims (list) – list of tuples, limits for each theta value for plotting; defaults to [0, 1] if native=False

  • theta_ref (list) – scalar reference values to plot as vlines on histplots and as red dots on bivariate plots

  • save (str) – file name to save plot

Returns

matplotlib figure