plot_pairs()#
- liesel.goose.plot_pairs(results, params=None, param_indices=None, chain_indices=None, max_chains=5, alpha=0.2, title=None, title_spacing=0.9, style='whitegrid', diag_kind='kde', color_palette=None, height=3, aspect_ratio=1.0, save_path=None, include_warmup=False, show=True, highlight_divergences='auto', divergence_scope='parameter')[source]#
Produces a pairplot panel.
- Parameters:
results (
SamplingResults|Mapping[str,ArrayLike]) – Result object of the sampling process. Must have a methodget_posterior_samples()which extracts all samples from the posterior distribution. Alternatively, you can directly supply a dictionary of samples, for example the output ofSamplingResults.get_posterior_samples.params (
str|list[str] |None, default:None) – Names of the model parameters that are contained in the plot. Must coincide with the dictionary keys of thePositionwith the posterior samples. IfNone, all parameters are included.param_indices (
int|Sequence[int] |None, default:None) – Indices of each model parameter that are contained in the plot. Selects e.g.beta[0]out of abetaparameter vector. A single index can be specified as an integer or a sequence containing one integer. IfNone, all subparameters are included.chain_indices (
int|Sequence[int] |None, default:None) – Indices of chains for each model subparameter that are contained in the plot. Selects e.g. chain 0 and chain 2 out of multiple chains. A single index can be specified as an integer or a sequence containing one integer. IfNone, all chains are included.max_chains (
int|None, default:5) – Upper bound how many chains are included within each subplot/facet. Avoids overplotting. IfNone, all chains contained in theresultsinput are plotted. Always starts chain selection from the lowest chain index upwards. For selecting specific chains use the argumentchain_indices.alpha (
float, default:0.2) – Amount of transparency; a float between 0 and 1.title_spacing (
float, default:0.9) – Determines the margin/whitespace between the plot title (set withfig.suptitle()) and the first row of subplots/facets. Passed to thetopargument offig.subplots_adjust().style (
str, default:'whitegrid') – Passed to thestyleargument ofsns.set_theme(). Valid options aredarkgrid,whitegrid,dark,white, andticks.diag_kind (
str, default:'kde') – Kind of plot for the diagonal subplots. Can be ‘kde’ (default) for kernel density estimates or ‘hist’ for histograms.color_palette (
str|list[str] |Mapping[int,str] |None, default:None) – Passed to the palette argument ofsns.pairplot(). String values must be valid inputs ofsns.color_palette()such as a seaborn color palette or a matplotlib colormap. Custom colors can be set with a list of color strings or a dictionary with the chain indices as keys and color strings as values. The number of color strings must coincide with the number of plotted chains. IfNone, the defaulttab10matplotlib colormap is chosen.height (
float, default:3) – Height in inches of each subplot/facet within the grid.aspect_ratio (
float, default:1.0) – Ratio of width / height of each subplot/facet within the grid, i.e.width = aspect_ratio * height.legend_position – Determines the color legend position. Coordinates are relative to the upper panel within the plot grid. The first coordinate specifies the horizontal, the second coordinate the vertical position. Might require an adjustment when changing the
figure_sizevalues or the number of chains.save_path (
str|None, default:None) – File path where the plot is saved.include_warmup (
bool, default:False) – Include warmup samples and initial values. Initial values have no transition diagnostic and are never highlighted.show (
bool, default:True) – Display the plot. Set toFalseto save or inspect the figure without displaying it.highlight_divergences (
bool|Literal['auto'], default:'auto') – With"auto"(default), highlight when usable diagnostics are available. Raw sample dictionaries and results known to have no HMC/NUTS kernels plot without markers. Missing, incomplete, or misaligned diagnostics, including a missing required kernel mapping, emit a warning and disable highlighting. SetTrueto require highlighting and raise on unusable diagnostics; setFalseto disable highlighting and skip diagnostic checks. Highlight draws associated with divergent HMC or NUTS transitions. RequiresSamplingResults. Includes NUTS transitions that also reached maximum tree depth. Scatter panels show opaque red crosses; each affected diagonal shows one red rug combining divergent draws across chains. Histograms and densities still use all retained draws and preserve chain colors. The rug also works for a single parameter. One shared “Divergent” legend entry is added only when at least one displayed panel has marked draws. Diagnostics respect thinning: discarded iterations are not displayed. Markers identify stored draws after the full kernel sequence, not intermediate locations along divergent trajectories.divergence_scope (
Literal['parameter','any'], default:'parameter') – Used when highlighting is enabled ("auto"orTrue). With"parameter"(default), each diagonal marks divergences from the kernel updating that parameter; off-diagonal panels mark a draw if a kernel updating either parameter diverged. RequiresSamplingResults.kernels_by_pos_key; unmapped parameters and parameters updated by other kernel types contribute no divergence flags. Components of a jointly updated vector share the kernel’s flags. With"any", every panel uses divergences from all HMC/NUTS kernels, including kernels updating unplotted parameters. This scope does not require the mapping.
- Raises:
TypeError – If
highlight_divergences=Trueis used with a raw sample dictionary.ValueError – If
highlight_divergencesis invalid, or highlighting is enabled anddivergence_scopeis invalid. Also raised in strict mode (True) for unusable diagnostics or a missing required kernel mapping.
- Warns:
UserWarning – In automatic mode, if highlighting is skipped because diagnostics or a required kernel mapping are unavailable or inconsistent.