superstats.diagnostics.plots.prior_push_forward#

Prior push-forward plotting helpers.

Functions

plot_push_forward(data[, data_dim, kind, ...])

Plot prior push-forward for a single data dimension.

superstats.diagnostics.plots.prior_push_forward.plot_push_forward(data, data_dim=0, kind='dist', aggregation=None, uncertainty_fun='95ci', marginal=True, spaghetti=False, alpha=0.5, num_cols=3, color='#356673', title_fontsize=22, label_fontsize=18, tick_fontsize=16, figsize=None, max_discrete_values=30)[source]#

Plot prior push-forward for a single data dimension.

Parameters:
datamapping of np.ndarray

Simulation data from the generative model, mapping observation names to arrays of shape (batch_size, steps).

data_dimint or str, optional, default: 0

Which observation variable to plot. Strings select by key and integers index the mapping’s key order.

kind{“dist”, “trajectory”}, optional, default: “dist”

Plot type: distribution of summary statistics or time-series trajectories.

aggregationcallable() or None, optional, default: None

Aggregation function over the dataset dimension, called as aggregation(x, axis=…) (e.g. np.mean, np.median). If None, individual datasets are shown in separate panels. If specified, all datasets are aggregated into a single panel.

uncertainty_fun{“std”, “95ci”, “mad”, “95hdi”} or callable() or None, optional, default: “95ci”

Uncertainty function. Only used when aggregation is not None and kind is “trajectory”. Ignored (with a warning) otherwise.

marginalbool, optional, default: True

Whether to draw marginal distributions beside trajectory plots.

spaghettibool, optional, default: False

Whether to draw individual trajectories behind the aggregate line.

num_colsint, optional, default: 3

Number of columns when rendering individual panels.

alphafloat in [0, 1], optional, default: 0.5

Alpha value for individual dataset traces.

colorstr, optional, default: “#822621”

Base color for plotted lines and fills.

title_fontsizeint, optional, default: 22

The font size of the panel titles.

label_fontsizeint, optional, default: 18

The font size of the axis label texts.

tick_fontsizeint, optional, default: 16

The font size of the axis tick labels.

figsizetuple of two floats or None, optional, default: None

Explicit figure size in inches. If None, the default layout size is used.

max_discrete_valuesint, optional, default: 30

Maximum number of discrete categories to treat the data as discrete.

Returns:
figplt.Figure - the figure instance for optional saving
Raises:
ValueError

If kind is not “dist” or “trajectory”, or if data has an unsupported shape.

Parameters: