plot_trace()#
- liesel.goose.plot_trace(results, params=None, param_indices=None, chain_indices=None, max_chains=5, title=None, title_spacing=0.85, xlabel='Iteration', style='whitegrid', color_palette=None, ncol=3, height=3, aspect_ratio=1, save_path=None, include_warmup=False, **kwargs)[source]#
Visualizes posterior samples over time with a trace plot.
- Parameters:
results (
SamplingResults
) – Result object of the sampling process. Must have a methodget_posterior_samples()
which extracts all samples from the posterior distribution.params (
Union
[str
,list
[str
],None
]) – Names of the model parameters that are contained in the plot. Must coincide with the dictionary keys of the Position with the posterior samples. If None, all parameters are included. (default:None
)param_indices (
Union
[int
,Sequence
[int
],None
]) – Indices of each model parameter that are contained in the plot. Selects e.g.beta[0]
out of abeta
parameter vector. A single index can be specified as an integer or a sequence containing one integer. IfNone
, all subparameters are included. (default:None
)chain_indices (
Union
[int
,Sequence
[int
],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. (default:None
)max_chains (
int
|None
) – Upper bound how many chains are included within each subplot/facet. Avoids overplotting. IfNone
, all chains contained in theresults
input are plotted. Always starts chain selection from the lowest chain index upwards. For selecting specific chains use the argumentchain_indices
. (default:5
)title_spacing (
float
) – Determines the margin/whitespace between the plot title (set withfig.suptitle()
) and the first row of subplots/facets. Passed to thetop
argument offig.subplots_adjust()
. (default:0.85
)xlabel (
str
) – Label of the x-axis. (default:'Iteration'
)style (
str
) – Passed to thestyle
argument ofsns.set_theme()
. Valid options are"darkgrid"
,"whitegrid"
,"dark"
,"white"
, and"ticks"
. (default:'whitegrid'
)color_palette (
Union
[str
,list
[str
],dict
[int
,str
],None
]) – Passed to the palette argument ofsns.relplot()
. 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 defaulttab10
matplotlib colormap is chosen. (default:None
)ncol (
int
) – Number of subplots/facets within each row of the grid. (default:3
)height (
int
) – Height in inches of each subplot/facet within the grid. (default:3
)aspect_ratio (
int
) – Ratio of width / height of each subplot/facet within the grid, i.e.width = aspect_ratio * height
. (default:1
)save_path (
Optional
[str
]) – File path where the plot is saved. (default:None
)include_warmup (
bool
) – Include the warmup samples in the trace plot. (default:False
)**kwargs – Further keyword arguments passed to the seaborn
relplot()
function.
- Return type:
FacetGrid
- Returns:
A seaborn
FacetGrid
.