arviz_plots.plot_compare#
- arviz_plots.plot_compare(cmp_df, relative_scale=False, rotated=False, hide_top_model=False, backend=None, visuals=None, **pc_kwargs)[source]#
Summary plot for model comparison.
Models are compared based on their expected log pointwise predictive density (ELPD). Or some transformation of it, such as the mean log predictive density (MLPD) or the geometric mean predictive density (GMPD).
Higher ELPD values indicate better predictive performance.
The ELPD is estimated by Pareto smoothed importance sampling leave-one-out cross-validation (LOO). Details are presented in [1] and [2].
The ELPD can only be interpreted in relative terms. But differences in ELPD less than 4 are considered negligible [3].
- Parameters:
- comp_df
pandas.DataFrame Usually this will be the result of the
arviz_stats.comparefunction. It is assumed that the DataFrame has two columns one named elpd, mlpd, or gmpd, the other named se, and the index is the model names. Additionally, it is assumed that the first row of the DataFrame is the top model.- relative_scalebool, optional.
If True, the stats values are scaled relative to the best model. Defaults to True.
- rotatedbool, optional
If True, the plot is rotated, with models on the y-axis and ELPD on the x-axis. Defaults to False.
- hide_top_modelbool, optional
If True, the top model (first row of comp_df) will not appear as a point with error bars or in the axis labels. Its performance can still be accessed by the visuals ref_line and/or ref_band. Defaults to False.
- backend{“bokeh”, “matplotlib”, “plotly”}
Select plotting backend. Defaults to rcParams[“plot.backend”].
- visualsmapping of {
strmapping or bool}, optional Valid keys are:
point_estimate -> passed to
scattererror_bar -> passed to
lineref_line -> passed to
hlineorvlinedepending on therotatedparameter.ref_band -> passed to
hspanorvspandepending on therotatedparameter. Defaults toFalse.similar_line -> passed to
hlineorvlinedepending on therotatedparameter. Defaults toFalse.title -> passed to
titleticklabels -> passed to
yticks
- **pc_kwargs
Passed to
arviz_plots.PlotCollection
- comp_df
- Returns:
See also
arviz_stats.compareSummary plot for model comparison.
arviz_stats.looCompute the ELPD using Pareto smoothed importance sampling Leave-one-out cross-validation method.
References
[1]Vehtari et al. Practical Bayesian model evaluation using leave-one-out cross-validation and WAIC. Statistics and Computing. 27(5) (2017). https://doi.org/10.1007/s11222-016-9696-4. arXiv preprint https://arxiv.org/abs/1507.04544.
[2]Vehtari et al. Pareto Smoothed Importance Sampling. Journal of Machine Learning Research, 25(72) (2024) https://jmlr.org/papers/v25/19-556.html arXiv preprint https://arxiv.org/abs/1507.02646
[3]Sivula et al. Uncertainty in Bayesian Leave-One-Out Cross-Validation Based Model Comparison. (2025). https://doi.org/10.48550/arXiv.2008.10296