superstats.diagnostics.plots.prior_push_forward#
Prior push-forward plotting helpers.
Functions
|
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:
- data
mappingofnp.ndarray Simulation data from the generative model, mapping observation names to arrays of shape (batch_size, steps).
- data_dim
intorstr,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.
- aggregation
callable()orNone,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”}
orcallable()orNone,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_cols
int,optional, default: 3 Number of columns when rendering individual panels.
- alpha
floatin[0, 1],optional, default: 0.5 Alpha value for individual dataset traces.
- color
str,optional, default: “#822621” Base color for plotted lines and fills.
- title_fontsize
int,optional, default: 22 The font size of the panel titles.
- label_fontsize
int,optional, default: 18 The font size of the axis label texts.
- tick_fontsize
int,optional, default: 16 The font size of the axis tick labels.
- figsize
tupleoftwofloatsorNone,optional, default:None Explicit figure size in inches. If None, the default layout size is used.
- max_discrete_values
int,optional, default: 30 Maximum number of discrete categories to treat the data as discrete.
- data
- Returns:
- fig
plt.Figure-thefigureinstanceforoptionalsaving
- fig
- Raises:
ValueErrorIf kind is not “dist” or “trajectory”, or if data has an unsupported shape.
- Parameters:
kind (Literal['trajectory', 'dist'])
aggregation (Callable | None)
uncertainty_fun (Literal['std', '95ci', 'mad', '95hdi'] | ~collections.abc.Callable | None)
marginal (bool)
spaghetti (bool)
alpha (float)
num_cols (int)
color (str)
title_fontsize (int)
label_fontsize (int)
tick_fontsize (int)
max_discrete_values (int)