arviz 0.23.3__py3-none-any.whl → 1.0.0rc0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- arviz/__init__.py +52 -367
- arviz-1.0.0rc0.dist-info/METADATA +182 -0
- arviz-1.0.0rc0.dist-info/RECORD +5 -0
- {arviz-0.23.3.dist-info → arviz-1.0.0rc0.dist-info}/WHEEL +1 -2
- {arviz-0.23.3.dist-info → arviz-1.0.0rc0.dist-info}/licenses/LICENSE +0 -1
- arviz/data/__init__.py +0 -55
- arviz/data/base.py +0 -596
- arviz/data/converters.py +0 -203
- arviz/data/datasets.py +0 -161
- arviz/data/example_data/code/radon/radon.json +0 -326
- arviz/data/example_data/data/centered_eight.nc +0 -0
- arviz/data/example_data/data/non_centered_eight.nc +0 -0
- arviz/data/example_data/data_local.json +0 -12
- arviz/data/example_data/data_remote.json +0 -58
- arviz/data/inference_data.py +0 -2386
- arviz/data/io_beanmachine.py +0 -112
- arviz/data/io_cmdstan.py +0 -1036
- arviz/data/io_cmdstanpy.py +0 -1233
- arviz/data/io_datatree.py +0 -23
- arviz/data/io_dict.py +0 -462
- arviz/data/io_emcee.py +0 -317
- arviz/data/io_json.py +0 -54
- arviz/data/io_netcdf.py +0 -68
- arviz/data/io_numpyro.py +0 -497
- arviz/data/io_pyjags.py +0 -378
- arviz/data/io_pyro.py +0 -333
- arviz/data/io_pystan.py +0 -1095
- arviz/data/io_zarr.py +0 -46
- arviz/data/utils.py +0 -139
- arviz/labels.py +0 -210
- arviz/plots/__init__.py +0 -61
- arviz/plots/autocorrplot.py +0 -171
- arviz/plots/backends/__init__.py +0 -223
- arviz/plots/backends/bokeh/__init__.py +0 -166
- arviz/plots/backends/bokeh/autocorrplot.py +0 -101
- arviz/plots/backends/bokeh/bfplot.py +0 -23
- arviz/plots/backends/bokeh/bpvplot.py +0 -193
- arviz/plots/backends/bokeh/compareplot.py +0 -167
- arviz/plots/backends/bokeh/densityplot.py +0 -239
- arviz/plots/backends/bokeh/distcomparisonplot.py +0 -23
- arviz/plots/backends/bokeh/distplot.py +0 -183
- arviz/plots/backends/bokeh/dotplot.py +0 -113
- arviz/plots/backends/bokeh/ecdfplot.py +0 -73
- arviz/plots/backends/bokeh/elpdplot.py +0 -203
- arviz/plots/backends/bokeh/energyplot.py +0 -155
- arviz/plots/backends/bokeh/essplot.py +0 -176
- arviz/plots/backends/bokeh/forestplot.py +0 -772
- arviz/plots/backends/bokeh/hdiplot.py +0 -54
- arviz/plots/backends/bokeh/kdeplot.py +0 -268
- arviz/plots/backends/bokeh/khatplot.py +0 -163
- arviz/plots/backends/bokeh/lmplot.py +0 -185
- arviz/plots/backends/bokeh/loopitplot.py +0 -211
- arviz/plots/backends/bokeh/mcseplot.py +0 -184
- arviz/plots/backends/bokeh/pairplot.py +0 -328
- arviz/plots/backends/bokeh/parallelplot.py +0 -81
- arviz/plots/backends/bokeh/posteriorplot.py +0 -324
- arviz/plots/backends/bokeh/ppcplot.py +0 -379
- arviz/plots/backends/bokeh/rankplot.py +0 -149
- arviz/plots/backends/bokeh/separationplot.py +0 -107
- arviz/plots/backends/bokeh/traceplot.py +0 -436
- arviz/plots/backends/bokeh/violinplot.py +0 -164
- arviz/plots/backends/matplotlib/__init__.py +0 -124
- arviz/plots/backends/matplotlib/autocorrplot.py +0 -72
- arviz/plots/backends/matplotlib/bfplot.py +0 -78
- arviz/plots/backends/matplotlib/bpvplot.py +0 -177
- arviz/plots/backends/matplotlib/compareplot.py +0 -135
- arviz/plots/backends/matplotlib/densityplot.py +0 -194
- arviz/plots/backends/matplotlib/distcomparisonplot.py +0 -119
- arviz/plots/backends/matplotlib/distplot.py +0 -178
- arviz/plots/backends/matplotlib/dotplot.py +0 -116
- arviz/plots/backends/matplotlib/ecdfplot.py +0 -70
- arviz/plots/backends/matplotlib/elpdplot.py +0 -189
- arviz/plots/backends/matplotlib/energyplot.py +0 -113
- arviz/plots/backends/matplotlib/essplot.py +0 -180
- arviz/plots/backends/matplotlib/forestplot.py +0 -656
- arviz/plots/backends/matplotlib/hdiplot.py +0 -48
- arviz/plots/backends/matplotlib/kdeplot.py +0 -177
- arviz/plots/backends/matplotlib/khatplot.py +0 -241
- arviz/plots/backends/matplotlib/lmplot.py +0 -149
- arviz/plots/backends/matplotlib/loopitplot.py +0 -144
- arviz/plots/backends/matplotlib/mcseplot.py +0 -161
- arviz/plots/backends/matplotlib/pairplot.py +0 -355
- arviz/plots/backends/matplotlib/parallelplot.py +0 -58
- arviz/plots/backends/matplotlib/posteriorplot.py +0 -348
- arviz/plots/backends/matplotlib/ppcplot.py +0 -478
- arviz/plots/backends/matplotlib/rankplot.py +0 -119
- arviz/plots/backends/matplotlib/separationplot.py +0 -97
- arviz/plots/backends/matplotlib/traceplot.py +0 -526
- arviz/plots/backends/matplotlib/tsplot.py +0 -121
- arviz/plots/backends/matplotlib/violinplot.py +0 -148
- arviz/plots/bfplot.py +0 -128
- arviz/plots/bpvplot.py +0 -308
- arviz/plots/compareplot.py +0 -177
- arviz/plots/densityplot.py +0 -284
- arviz/plots/distcomparisonplot.py +0 -197
- arviz/plots/distplot.py +0 -233
- arviz/plots/dotplot.py +0 -233
- arviz/plots/ecdfplot.py +0 -372
- arviz/plots/elpdplot.py +0 -174
- arviz/plots/energyplot.py +0 -147
- arviz/plots/essplot.py +0 -319
- arviz/plots/forestplot.py +0 -304
- arviz/plots/hdiplot.py +0 -211
- arviz/plots/kdeplot.py +0 -357
- arviz/plots/khatplot.py +0 -236
- arviz/plots/lmplot.py +0 -380
- arviz/plots/loopitplot.py +0 -224
- arviz/plots/mcseplot.py +0 -194
- arviz/plots/pairplot.py +0 -281
- arviz/plots/parallelplot.py +0 -204
- arviz/plots/plot_utils.py +0 -599
- arviz/plots/posteriorplot.py +0 -298
- arviz/plots/ppcplot.py +0 -369
- arviz/plots/rankplot.py +0 -232
- arviz/plots/separationplot.py +0 -167
- arviz/plots/styles/arviz-bluish.mplstyle +0 -1
- arviz/plots/styles/arviz-brownish.mplstyle +0 -1
- arviz/plots/styles/arviz-colors.mplstyle +0 -2
- arviz/plots/styles/arviz-cyanish.mplstyle +0 -1
- arviz/plots/styles/arviz-darkgrid.mplstyle +0 -40
- arviz/plots/styles/arviz-doc.mplstyle +0 -88
- arviz/plots/styles/arviz-docgrid.mplstyle +0 -88
- arviz/plots/styles/arviz-grayscale.mplstyle +0 -41
- arviz/plots/styles/arviz-greenish.mplstyle +0 -1
- arviz/plots/styles/arviz-orangish.mplstyle +0 -1
- arviz/plots/styles/arviz-plasmish.mplstyle +0 -1
- arviz/plots/styles/arviz-purplish.mplstyle +0 -1
- arviz/plots/styles/arviz-redish.mplstyle +0 -1
- arviz/plots/styles/arviz-royish.mplstyle +0 -1
- arviz/plots/styles/arviz-viridish.mplstyle +0 -1
- arviz/plots/styles/arviz-white.mplstyle +0 -40
- arviz/plots/styles/arviz-whitegrid.mplstyle +0 -40
- arviz/plots/traceplot.py +0 -273
- arviz/plots/tsplot.py +0 -440
- arviz/plots/violinplot.py +0 -192
- arviz/preview.py +0 -58
- arviz/py.typed +0 -0
- arviz/rcparams.py +0 -606
- arviz/sel_utils.py +0 -223
- arviz/static/css/style.css +0 -340
- arviz/static/html/icons-svg-inline.html +0 -15
- arviz/stats/__init__.py +0 -37
- arviz/stats/density_utils.py +0 -1013
- arviz/stats/diagnostics.py +0 -1013
- arviz/stats/ecdf_utils.py +0 -324
- arviz/stats/stats.py +0 -2422
- arviz/stats/stats_refitting.py +0 -119
- arviz/stats/stats_utils.py +0 -609
- arviz/tests/__init__.py +0 -1
- arviz/tests/base_tests/__init__.py +0 -1
- arviz/tests/base_tests/test_data.py +0 -1679
- arviz/tests/base_tests/test_data_zarr.py +0 -143
- arviz/tests/base_tests/test_diagnostics.py +0 -511
- arviz/tests/base_tests/test_diagnostics_numba.py +0 -87
- arviz/tests/base_tests/test_helpers.py +0 -18
- arviz/tests/base_tests/test_labels.py +0 -69
- arviz/tests/base_tests/test_plot_utils.py +0 -342
- arviz/tests/base_tests/test_plots_bokeh.py +0 -1288
- arviz/tests/base_tests/test_plots_matplotlib.py +0 -2197
- arviz/tests/base_tests/test_rcparams.py +0 -317
- arviz/tests/base_tests/test_stats.py +0 -925
- arviz/tests/base_tests/test_stats_ecdf_utils.py +0 -166
- arviz/tests/base_tests/test_stats_numba.py +0 -45
- arviz/tests/base_tests/test_stats_utils.py +0 -384
- arviz/tests/base_tests/test_utils.py +0 -376
- arviz/tests/base_tests/test_utils_numba.py +0 -87
- arviz/tests/conftest.py +0 -46
- arviz/tests/external_tests/__init__.py +0 -1
- arviz/tests/external_tests/test_data_beanmachine.py +0 -78
- arviz/tests/external_tests/test_data_cmdstan.py +0 -398
- arviz/tests/external_tests/test_data_cmdstanpy.py +0 -496
- arviz/tests/external_tests/test_data_emcee.py +0 -166
- arviz/tests/external_tests/test_data_numpyro.py +0 -434
- arviz/tests/external_tests/test_data_pyjags.py +0 -119
- arviz/tests/external_tests/test_data_pyro.py +0 -260
- arviz/tests/external_tests/test_data_pystan.py +0 -307
- arviz/tests/helpers.py +0 -677
- arviz/utils.py +0 -773
- arviz/wrappers/__init__.py +0 -13
- arviz/wrappers/base.py +0 -236
- arviz/wrappers/wrap_pymc.py +0 -36
- arviz/wrappers/wrap_stan.py +0 -148
- arviz-0.23.3.dist-info/METADATA +0 -264
- arviz-0.23.3.dist-info/RECORD +0 -183
- arviz-0.23.3.dist-info/top_level.txt +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
axes.prop_cycle: cycler('color', ['bf0700', 'fd5800', 'ffba02', 'ffba0277', '000000'])
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
axes.prop_cycle: cycler('color', ['481d6f', '2f6b8e', '25ab82', 'b0dd2f', '000000'])
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
# This style is based on Seaborn-white parameters, the main differences are
|
|
2
|
-
# Default matplotlib font (no problem using Greek letters!)
|
|
3
|
-
# Larger font size for several elements
|
|
4
|
-
# Colorblind friendly color cycle
|
|
5
|
-
figure.figsize: 7.2, 4.8
|
|
6
|
-
figure.dpi: 100.0
|
|
7
|
-
figure.facecolor: white
|
|
8
|
-
figure.constrained_layout.use: True
|
|
9
|
-
text.color: .15
|
|
10
|
-
axes.labelcolor: .15
|
|
11
|
-
legend.frameon: False
|
|
12
|
-
legend.numpoints: 1
|
|
13
|
-
legend.scatterpoints: 1
|
|
14
|
-
xtick.direction: out
|
|
15
|
-
ytick.direction: out
|
|
16
|
-
xtick.color: .15
|
|
17
|
-
ytick.color: .15
|
|
18
|
-
axes.axisbelow: True
|
|
19
|
-
lines.solid_capstyle: round
|
|
20
|
-
|
|
21
|
-
axes.labelsize: 15
|
|
22
|
-
axes.titlesize: 16
|
|
23
|
-
xtick.labelsize: 14
|
|
24
|
-
ytick.labelsize: 14
|
|
25
|
-
legend.fontsize: 14
|
|
26
|
-
|
|
27
|
-
axes.grid: False
|
|
28
|
-
axes.facecolor: white
|
|
29
|
-
axes.edgecolor: 0
|
|
30
|
-
axes.linewidth: 1
|
|
31
|
-
axes.spines.top: False
|
|
32
|
-
axes.spines.right: False
|
|
33
|
-
image.cmap: viridis
|
|
34
|
-
xtick.major.size: 0
|
|
35
|
-
ytick.major.size: 0
|
|
36
|
-
xtick.minor.size: 0
|
|
37
|
-
ytick.minor.size: 0
|
|
38
|
-
|
|
39
|
-
# color-blind friendly cycle designed using https://colorcyclepicker.mpetroff.net/
|
|
40
|
-
axes.prop_cycle: cycler('color', ['2a2eec', 'fa7c17', '328c06', 'c10c90', '933708', '65e5f3', 'e6e135', '1ccd6a', 'bd8ad5', 'b16b57'])
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
# This style is based on Seaborn-whitegrid parameters, the main differences are
|
|
2
|
-
# Default matplotlib font (no problem using Greek letters!)
|
|
3
|
-
# Larger font size for several elements
|
|
4
|
-
# Colorblind friendly color cycle
|
|
5
|
-
figure.figsize: 7.2, 4.8
|
|
6
|
-
figure.dpi: 100.0
|
|
7
|
-
figure.facecolor: white
|
|
8
|
-
figure.constrained_layout.use: True
|
|
9
|
-
text.color: .15
|
|
10
|
-
axes.labelcolor: .15
|
|
11
|
-
legend.frameon: False
|
|
12
|
-
legend.numpoints: 1
|
|
13
|
-
legend.scatterpoints: 1
|
|
14
|
-
xtick.direction: out
|
|
15
|
-
ytick.direction: out
|
|
16
|
-
xtick.color: .15
|
|
17
|
-
ytick.color: .15
|
|
18
|
-
axes.axisbelow: True
|
|
19
|
-
grid.linestyle: -
|
|
20
|
-
lines.solid_capstyle: round
|
|
21
|
-
|
|
22
|
-
axes.labelsize: 15
|
|
23
|
-
axes.titlesize: 16
|
|
24
|
-
xtick.labelsize: 14
|
|
25
|
-
ytick.labelsize: 14
|
|
26
|
-
legend.fontsize: 14
|
|
27
|
-
|
|
28
|
-
axes.grid: True
|
|
29
|
-
axes.facecolor: white
|
|
30
|
-
axes.edgecolor: .8
|
|
31
|
-
axes.linewidth: 1
|
|
32
|
-
grid.color: .8
|
|
33
|
-
image.cmap: viridis
|
|
34
|
-
xtick.major.size: 0
|
|
35
|
-
ytick.major.size: 0
|
|
36
|
-
xtick.minor.size: 0
|
|
37
|
-
ytick.minor.size: 0
|
|
38
|
-
|
|
39
|
-
# color-blind friendly cycle designed using https://colorcyclepicker.mpetroff.net/
|
|
40
|
-
axes.prop_cycle: cycler('color', ['2a2eec', 'fa7c17', '328c06', 'c10c90', '933708', '65e5f3', 'e6e135', '1ccd6a', 'bd8ad5', 'b16b57'])
|
arviz/plots/traceplot.py
DELETED
|
@@ -1,273 +0,0 @@
|
|
|
1
|
-
"""Plot kde or histograms and values from MCMC samples."""
|
|
2
|
-
|
|
3
|
-
import warnings
|
|
4
|
-
from typing import Any, Callable, List, Mapping, Optional, Tuple, Union, Sequence
|
|
5
|
-
|
|
6
|
-
from ..data import CoordSpec, InferenceData, convert_to_dataset
|
|
7
|
-
from ..labels import BaseLabeller
|
|
8
|
-
from ..rcparams import rcParams
|
|
9
|
-
from ..sel_utils import xarray_var_iter
|
|
10
|
-
from ..utils import _var_names, get_coords
|
|
11
|
-
from .plot_utils import KwargSpec, get_plotting_function
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
def plot_trace(
|
|
15
|
-
data: InferenceData,
|
|
16
|
-
var_names: Optional[Sequence[str]] = None,
|
|
17
|
-
filter_vars: Optional[str] = None,
|
|
18
|
-
transform: Optional[Callable] = None,
|
|
19
|
-
coords: Optional[CoordSpec] = None,
|
|
20
|
-
divergences: Optional[str] = "auto",
|
|
21
|
-
kind: Optional[str] = "trace",
|
|
22
|
-
figsize: Optional[Tuple[float, float]] = None,
|
|
23
|
-
rug: bool = False,
|
|
24
|
-
lines: Optional[List[Tuple[str, CoordSpec, Any]]] = None,
|
|
25
|
-
circ_var_names: Optional[List[str]] = None,
|
|
26
|
-
circ_var_units: str = "radians",
|
|
27
|
-
compact: bool = True,
|
|
28
|
-
compact_prop: Optional[Union[str, Mapping[str, Any]]] = None,
|
|
29
|
-
combined: bool = False,
|
|
30
|
-
chain_prop: Optional[Union[str, Mapping[str, Any]]] = None,
|
|
31
|
-
legend: bool = False,
|
|
32
|
-
plot_kwargs: Optional[KwargSpec] = None,
|
|
33
|
-
fill_kwargs: Optional[KwargSpec] = None,
|
|
34
|
-
rug_kwargs: Optional[KwargSpec] = None,
|
|
35
|
-
hist_kwargs: Optional[KwargSpec] = None,
|
|
36
|
-
trace_kwargs: Optional[KwargSpec] = None,
|
|
37
|
-
rank_kwargs: Optional[KwargSpec] = None,
|
|
38
|
-
labeller=None,
|
|
39
|
-
axes=None,
|
|
40
|
-
backend: Optional[str] = None,
|
|
41
|
-
backend_config: Optional[KwargSpec] = None,
|
|
42
|
-
backend_kwargs: Optional[KwargSpec] = None,
|
|
43
|
-
show: Optional[bool] = None,
|
|
44
|
-
):
|
|
45
|
-
"""Plot distribution (histogram or kernel density estimates) and sampled values or rank plot.
|
|
46
|
-
|
|
47
|
-
If `divergences` data is available in `sample_stats`, will plot the location of divergences as
|
|
48
|
-
dashed vertical lines.
|
|
49
|
-
|
|
50
|
-
Parameters
|
|
51
|
-
----------
|
|
52
|
-
data: obj
|
|
53
|
-
Any object that can be converted to an :class:`arviz.InferenceData` object
|
|
54
|
-
Refer to documentation of :func:`arviz.convert_to_dataset` for details
|
|
55
|
-
var_names: str or list of str, optional
|
|
56
|
-
One or more variables to be plotted. Prefix the variables by ``~`` when you want
|
|
57
|
-
to exclude them from the plot.
|
|
58
|
-
filter_vars: {None, "like", "regex"}, optional, default=None
|
|
59
|
-
If `None` (default), interpret var_names as the real variables names. If "like",
|
|
60
|
-
interpret var_names as substrings of the real variables names. If "regex",
|
|
61
|
-
interpret var_names as regular expressions on the real variables names. A la
|
|
62
|
-
``pandas.filter``.
|
|
63
|
-
coords: dict of {str: slice or array_like}, optional
|
|
64
|
-
Coordinates of var_names to be plotted. Passed to :meth:`xarray.Dataset.sel`
|
|
65
|
-
divergences: {"bottom", "top", None}, optional
|
|
66
|
-
Plot location of divergences on the traceplots.
|
|
67
|
-
kind: {"trace", "rank_bars", "rank_vlines"}, optional
|
|
68
|
-
Choose between plotting sampled values per iteration and rank plots.
|
|
69
|
-
transform: callable, optional
|
|
70
|
-
Function to transform data (defaults to None i.e.the identity function)
|
|
71
|
-
figsize: tuple of (float, float), optional
|
|
72
|
-
If None, size is (12, variables * 2)
|
|
73
|
-
rug: bool, optional
|
|
74
|
-
If True adds a rugplot of samples. Defaults to False. Ignored for 2D KDE.
|
|
75
|
-
Only affects continuous variables.
|
|
76
|
-
lines: list of tuple of (str, dict, array_like), optional
|
|
77
|
-
List of (var_name, {'coord': selection}, [line, positions]) to be overplotted as
|
|
78
|
-
vertical lines on the density and horizontal lines on the trace.
|
|
79
|
-
circ_var_names : str or list of str, optional
|
|
80
|
-
List of circular variables to account for when plotting KDE.
|
|
81
|
-
circ_var_units : str
|
|
82
|
-
Whether the variables in ``circ_var_names`` are in "degrees" or "radians".
|
|
83
|
-
compact: bool, optional
|
|
84
|
-
Plot multidimensional variables in a single plot.
|
|
85
|
-
compact_prop: str or dict {str: array_like}, optional
|
|
86
|
-
Defines the property name and the property values to distinguish different
|
|
87
|
-
dimensions with compact=True.
|
|
88
|
-
When compact=True it defaults to color, it is
|
|
89
|
-
ignored otherwise.
|
|
90
|
-
combined: bool, optional
|
|
91
|
-
Flag for combining multiple chains into a single line. If False (default), chains will be
|
|
92
|
-
plotted separately.
|
|
93
|
-
chain_prop: str or dict {str: array_like}, optional
|
|
94
|
-
Defines the property name and the property values to distinguish different chains.
|
|
95
|
-
If compact=True it defaults to linestyle,
|
|
96
|
-
otherwise it uses the color to distinguish
|
|
97
|
-
different chains.
|
|
98
|
-
legend: bool, optional
|
|
99
|
-
Add a legend to the figure with the chain color code.
|
|
100
|
-
plot_kwargs, fill_kwargs, rug_kwargs, hist_kwargs: dict, optional
|
|
101
|
-
Extra keyword arguments passed to :func:`arviz.plot_dist`. Only affects continuous
|
|
102
|
-
variables.
|
|
103
|
-
trace_kwargs: dict, optional
|
|
104
|
-
Extra keyword arguments passed to :meth:`matplotlib.axes.Axes.plot`
|
|
105
|
-
labeller : labeller instance, optional
|
|
106
|
-
Class providing the method ``make_label_vert`` to generate the labels in the plot titles.
|
|
107
|
-
Read the :ref:`label_guide` for more details and usage examples.
|
|
108
|
-
rank_kwargs : dict, optional
|
|
109
|
-
Extra keyword arguments passed to :func:`arviz.plot_rank`
|
|
110
|
-
axes: axes, optional
|
|
111
|
-
Matplotlib axes or bokeh figures.
|
|
112
|
-
backend: {"matplotlib", "bokeh"}, optional
|
|
113
|
-
Select plotting backend.
|
|
114
|
-
backend_config: dict, optional
|
|
115
|
-
Currently specifies the bounds to use for bokeh axes. Defaults to value set in rcParams.
|
|
116
|
-
backend_kwargs: dict, optional
|
|
117
|
-
These are kwargs specific to the backend being used, passed to
|
|
118
|
-
:func:`matplotlib.pyplot.subplots` or
|
|
119
|
-
:func:`bokeh.plotting.figure`.
|
|
120
|
-
show: bool, optional
|
|
121
|
-
Call backend show function.
|
|
122
|
-
|
|
123
|
-
Returns
|
|
124
|
-
-------
|
|
125
|
-
axes: matplotlib axes or bokeh figures
|
|
126
|
-
|
|
127
|
-
See Also
|
|
128
|
-
--------
|
|
129
|
-
plot_rank : Plot rank order statistics of chains.
|
|
130
|
-
|
|
131
|
-
Examples
|
|
132
|
-
--------
|
|
133
|
-
Plot a subset variables and select them with partial naming
|
|
134
|
-
|
|
135
|
-
.. plot::
|
|
136
|
-
:context: close-figs
|
|
137
|
-
|
|
138
|
-
>>> import arviz as az
|
|
139
|
-
>>> data = az.load_arviz_data('non_centered_eight')
|
|
140
|
-
>>> coords = {'school': ['Choate', 'Lawrenceville']}
|
|
141
|
-
>>> az.plot_trace(data, var_names=('theta'), filter_vars="like", coords=coords)
|
|
142
|
-
|
|
143
|
-
Show all dimensions of multidimensional variables in the same plot
|
|
144
|
-
|
|
145
|
-
.. plot::
|
|
146
|
-
:context: close-figs
|
|
147
|
-
|
|
148
|
-
>>> az.plot_trace(data, compact=True)
|
|
149
|
-
|
|
150
|
-
Display a rank plot instead of trace
|
|
151
|
-
|
|
152
|
-
.. plot::
|
|
153
|
-
:context: close-figs
|
|
154
|
-
|
|
155
|
-
>>> az.plot_trace(data, var_names=["mu", "tau"], kind="rank_bars")
|
|
156
|
-
|
|
157
|
-
Combine all chains into one distribution and select variables with regular expressions
|
|
158
|
-
|
|
159
|
-
.. plot::
|
|
160
|
-
:context: close-figs
|
|
161
|
-
|
|
162
|
-
>>> az.plot_trace(
|
|
163
|
-
>>> data, var_names=('^theta'), filter_vars="regex", coords=coords, combined=True
|
|
164
|
-
>>> )
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
Plot reference lines against distribution and trace
|
|
168
|
-
|
|
169
|
-
.. plot::
|
|
170
|
-
:context: close-figs
|
|
171
|
-
|
|
172
|
-
>>> lines = (('theta_t',{'school': "Choate"}, [-1]),)
|
|
173
|
-
>>> az.plot_trace(data, var_names=('theta_t', 'theta'), coords=coords, lines=lines)
|
|
174
|
-
|
|
175
|
-
"""
|
|
176
|
-
if kind not in {"trace", "rank_vlines", "rank_bars"}:
|
|
177
|
-
raise ValueError("The value of kind must be either trace, rank_vlines or rank_bars.")
|
|
178
|
-
|
|
179
|
-
if divergences == "auto":
|
|
180
|
-
divergences = "top" if rug else "bottom"
|
|
181
|
-
if divergences:
|
|
182
|
-
try:
|
|
183
|
-
divergence_data = convert_to_dataset(data, group="sample_stats").diverging.transpose(
|
|
184
|
-
"chain", "draw"
|
|
185
|
-
)
|
|
186
|
-
except (ValueError, AttributeError): # No sample_stats, or no `.diverging`
|
|
187
|
-
divergences = None
|
|
188
|
-
|
|
189
|
-
if coords is None:
|
|
190
|
-
coords = {}
|
|
191
|
-
|
|
192
|
-
if labeller is None:
|
|
193
|
-
labeller = BaseLabeller()
|
|
194
|
-
|
|
195
|
-
if divergences:
|
|
196
|
-
divergence_data = get_coords(
|
|
197
|
-
divergence_data, {k: v for k, v in coords.items() if k in ("chain", "draw")}
|
|
198
|
-
)
|
|
199
|
-
else:
|
|
200
|
-
divergence_data = False
|
|
201
|
-
|
|
202
|
-
coords_data = get_coords(convert_to_dataset(data, group="posterior"), coords)
|
|
203
|
-
|
|
204
|
-
if transform is not None:
|
|
205
|
-
coords_data = transform(coords_data)
|
|
206
|
-
|
|
207
|
-
var_names = _var_names(var_names, coords_data, filter_vars)
|
|
208
|
-
|
|
209
|
-
skip_dims = set(coords_data.dims) - {"chain", "draw"} if compact else set()
|
|
210
|
-
|
|
211
|
-
plotters = list(
|
|
212
|
-
xarray_var_iter(
|
|
213
|
-
coords_data,
|
|
214
|
-
var_names=var_names,
|
|
215
|
-
combined=True,
|
|
216
|
-
skip_dims=skip_dims,
|
|
217
|
-
dim_order=["chain", "draw"],
|
|
218
|
-
)
|
|
219
|
-
)
|
|
220
|
-
max_plots = rcParams["plot.max_subplots"]
|
|
221
|
-
max_plots = len(plotters) if max_plots is None else max(max_plots // 2, 1)
|
|
222
|
-
if len(plotters) > max_plots:
|
|
223
|
-
warnings.warn(
|
|
224
|
-
"rcParams['plot.max_subplots'] ({max_plots}) is smaller than the number "
|
|
225
|
-
"of variables to plot ({len_plotters}), generating only {max_plots} "
|
|
226
|
-
"plots".format(max_plots=max_plots, len_plotters=len(plotters)),
|
|
227
|
-
UserWarning,
|
|
228
|
-
)
|
|
229
|
-
plotters = plotters[:max_plots]
|
|
230
|
-
|
|
231
|
-
# TODO: Check if this can be further simplified
|
|
232
|
-
trace_plot_args = dict(
|
|
233
|
-
# User Kwargs
|
|
234
|
-
data=coords_data,
|
|
235
|
-
var_names=var_names,
|
|
236
|
-
# coords = coords,
|
|
237
|
-
divergences=divergences,
|
|
238
|
-
kind=kind,
|
|
239
|
-
figsize=figsize,
|
|
240
|
-
rug=rug,
|
|
241
|
-
lines=lines,
|
|
242
|
-
circ_var_names=circ_var_names,
|
|
243
|
-
circ_var_units=circ_var_units,
|
|
244
|
-
plot_kwargs=plot_kwargs,
|
|
245
|
-
fill_kwargs=fill_kwargs,
|
|
246
|
-
rug_kwargs=rug_kwargs,
|
|
247
|
-
hist_kwargs=hist_kwargs,
|
|
248
|
-
trace_kwargs=trace_kwargs,
|
|
249
|
-
rank_kwargs=rank_kwargs,
|
|
250
|
-
compact=compact,
|
|
251
|
-
compact_prop=compact_prop,
|
|
252
|
-
combined=combined,
|
|
253
|
-
chain_prop=chain_prop,
|
|
254
|
-
legend=legend,
|
|
255
|
-
labeller=labeller,
|
|
256
|
-
# Generated kwargs
|
|
257
|
-
divergence_data=divergence_data,
|
|
258
|
-
# skip_dims=skip_dims,
|
|
259
|
-
plotters=plotters,
|
|
260
|
-
axes=axes,
|
|
261
|
-
backend_config=backend_config,
|
|
262
|
-
backend_kwargs=backend_kwargs,
|
|
263
|
-
show=show,
|
|
264
|
-
)
|
|
265
|
-
|
|
266
|
-
if backend is None:
|
|
267
|
-
backend = rcParams["plot.backend"]
|
|
268
|
-
backend = backend.lower()
|
|
269
|
-
|
|
270
|
-
plot = get_plotting_function("plot_trace", "traceplot", backend)
|
|
271
|
-
axes = plot(**trace_plot_args)
|
|
272
|
-
|
|
273
|
-
return axes
|