superstats.diagnostics.plots.prior_samples#
Prior sample visualization helpers.
Functions
|
Plot joint prior diagnostics combining hyperparameter distributions, shared parameter histograms, and time-varying trajectories. |
|
Plot time-invariant parameter distributions. |
|
Plot time-varying parameter trajectories with marginal KDE. |
- superstats.diagnostics.plots.prior_samples.plot_joint_prior(local_params, hyper_params, shared_params, param_bounds=None, mixture_names=None, hyper_param_groups=None, marginal=True, color='#356673', title_fontsize=22, tick_fontsize=16, alpha=0.5, figsize=None)[source]#
Plot joint prior diagnostics combining hyperparameter distributions, shared parameter histograms, and time-varying trajectories.
- Parameters:
- local_params
dictofnp.ndarray,eachofshape(num_trajectories,num_steps) Mapping from parameter name to an array of trajectories. Every StochasticTransition parameter is unconditionally added here by JointPrior.sample, so together with shared_params this is the authoritative set of row names.
- hyper_params
dictofnp.ndarray Mapping from hyperparameter name to an array of samples. Keys are f”{param_name}_{hyper_key}”.
- shared_params
dictofnp.ndarray Mapping from parameter name to an array of shared parameter samples.
- param_bounds
dictorNone,optional, default:None Mapping from parameter name to (lower, upper) y-axis limits.
- mixture_names
dictorNone,optional, default:None Mapping from parameter name to a list of component names for mixture weight parameters.
- hyper_param_groups
dictorNone,optional, default:None Mapping from each parameter name to the exact list of hyper_params keys it owns. Required to correctly separate rows when one parameter name is a prefix of another at an underscore boundary (e.g. “v_1” and “v_1_2”), since str.startswith cannot disambiguate that case from key strings alone. When provided (e.g. by JointPrior.plot_joint_prior), this is used instead of prefix matching. If omitted, falls back to prefix matching, which can misassign hyperparameters in the presence of such name collisions.
- marginalbool,
optional, default:True Whether to draw a marginal KDE panel beside each trajectory panel.
- color
str,optional, default:BASE_COLOR Base plotting color for KDEs and trajectories.
- title_fontsize
int,optional, default: 22 The font size of the panel titles (parameter names).
- tick_fontsize
int,optional, default: 16 The font size of the axis tick labels.
- alpha
floatin[0, 1],optional, default: 0.5 The opacity of individual trajectories.
- figsize
tupleoftwofloatsorNone,optional, default:None Explicit figure size in inches. If None, the default layout size is used.
- local_params
- Returns:
- fig
plt.Figure-thefigureinstanceforoptionalsaving
- fig
- Raises:
ValueErrorIf no plottable parameters are found across local_params, hyper_params, and shared_params.
- Parameters:
- Return type:
Figure
- superstats.diagnostics.plots.prior_samples.plot_time_invariant_prior(hyper_params, shared_params, mixture_names=None, color='#356673', num_cols=2, title_fontsize=22, label_fontsize=18, tick_fontsize=16, figsize=None)[source]#
Plot time-invariant parameter distributions.
- Parameters:
- hyper_params
dictofnp.ndarray Mapping from parameter name to an array of hyperparameter samples.
- shared_params
dictofnp.ndarray Mapping from parameter name to an array of shared parameter samples.
- mixture_names
dictorNone,optional, default:None Mapping from parameter name to a list of component names for mixture weight parameters.
- color
str,optional, default:BASE_COLOR Base color for non-mixture histograms.
- num_cols
int,optional, default: 2 Number of subplot columns.
- 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 labels.
- 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.
- hyper_params
- Returns:
- fig
plt.Figure-thefigureinstanceforoptionalsaving
- fig
- Raises:
ValueErrorIf both hyper_params and shared_params are empty.
- Parameters:
- Return type:
Figure
- superstats.diagnostics.plots.prior_samples.plot_time_varying_prior(local_params, param_bounds=None, num_cols=2, marginal=True, alpha=0.5, color='#356673', title_fontsize=22, label_fontsize=18, tick_fontsize=16, figsize=None)[source]#
Plot time-varying parameter trajectories with marginal KDE.
- Parameters:
- local_params
dictofnp.ndarray,eachofshape(num_trajectories,num_steps) Mapping from parameter name to an array of trajectories.
- param_bounds
dictorNone,optional, default:None Mapping from parameter name to (lower, upper) y-axis limits.
- num_cols
int,optional, default: 2 Number of subplot columns.
- marginalbool,
optional, default:True Whether to draw a marginal KDE panel beside each trajectory panel.
- alpha
floatin[0, 1],optional, default: 0.5 The opacity of individual trajectories.
- color
str,optional, default:BASE_COLOR Line color for individual trajectories and marginal KDE.
- 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 labels.
- 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.
- local_params
- Returns:
- fig
plt.Figure-thefigureinstanceforoptionalsaving
- fig
- Raises:
ValueErrorIf local_params is empty.
- Parameters:
- Return type:
Figure