arviz 0.23.1__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 -357
- arviz-1.0.0rc0.dist-info/METADATA +182 -0
- arviz-1.0.0rc0.dist-info/RECORD +5 -0
- {arviz-0.23.1.dist-info → arviz-1.0.0rc0.dist-info}/WHEEL +1 -2
- {arviz-0.23.1.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.1.dist-info/METADATA +0 -263
- arviz-0.23.1.dist-info/RECORD +0 -183
- arviz-0.23.1.dist-info/top_level.txt +0 -1
|
@@ -1,328 +0,0 @@
|
|
|
1
|
-
"""Bokeh pairplot."""
|
|
2
|
-
|
|
3
|
-
import warnings
|
|
4
|
-
from copy import deepcopy
|
|
5
|
-
from uuid import uuid4
|
|
6
|
-
|
|
7
|
-
import bokeh.plotting as bkp
|
|
8
|
-
import numpy as np
|
|
9
|
-
from bokeh.models import CDSView, ColumnDataSource, GroupFilter, Span
|
|
10
|
-
|
|
11
|
-
from ....rcparams import rcParams
|
|
12
|
-
from ...distplot import plot_dist
|
|
13
|
-
from ...kdeplot import plot_kde
|
|
14
|
-
from ...plot_utils import (
|
|
15
|
-
_scale_fig_size,
|
|
16
|
-
calculate_point_estimate,
|
|
17
|
-
vectorized_to_hex,
|
|
18
|
-
_init_kwargs_dict,
|
|
19
|
-
)
|
|
20
|
-
from .. import show_layout
|
|
21
|
-
from . import backend_kwarg_defaults
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
def plot_pair(
|
|
25
|
-
ax,
|
|
26
|
-
plotters,
|
|
27
|
-
numvars,
|
|
28
|
-
figsize,
|
|
29
|
-
textsize,
|
|
30
|
-
kind,
|
|
31
|
-
scatter_kwargs, # pylint: disable=unused-argument
|
|
32
|
-
kde_kwargs,
|
|
33
|
-
hexbin_kwargs,
|
|
34
|
-
gridsize, # pylint: disable=unused-argument
|
|
35
|
-
colorbar, # pylint: disable=unused-argument
|
|
36
|
-
divergences,
|
|
37
|
-
diverging_mask,
|
|
38
|
-
divergences_kwargs,
|
|
39
|
-
flat_var_names,
|
|
40
|
-
flat_ref_slices,
|
|
41
|
-
flat_var_labels,
|
|
42
|
-
backend_kwargs,
|
|
43
|
-
marginal_kwargs,
|
|
44
|
-
show,
|
|
45
|
-
marginals,
|
|
46
|
-
point_estimate,
|
|
47
|
-
point_estimate_kwargs,
|
|
48
|
-
point_estimate_marker_kwargs,
|
|
49
|
-
reference_values,
|
|
50
|
-
reference_values_kwargs,
|
|
51
|
-
):
|
|
52
|
-
"""Bokeh pair plot."""
|
|
53
|
-
backend_kwargs = _init_kwargs_dict(backend_kwargs)
|
|
54
|
-
|
|
55
|
-
backend_kwargs = {
|
|
56
|
-
**backend_kwarg_defaults(
|
|
57
|
-
("dpi", "plot.bokeh.figure.dpi"),
|
|
58
|
-
),
|
|
59
|
-
**backend_kwargs,
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
hexbin_kwargs = _init_kwargs_dict(hexbin_kwargs)
|
|
63
|
-
hexbin_kwargs.setdefault("size", 0.5)
|
|
64
|
-
|
|
65
|
-
marginal_kwargs = _init_kwargs_dict(marginal_kwargs)
|
|
66
|
-
point_estimate_kwargs = _init_kwargs_dict(point_estimate_kwargs)
|
|
67
|
-
kde_kwargs = _init_kwargs_dict(kde_kwargs)
|
|
68
|
-
|
|
69
|
-
if kind != "kde":
|
|
70
|
-
kde_kwargs.setdefault("contourf_kwargs", {})
|
|
71
|
-
kde_kwargs["contourf_kwargs"].setdefault("fill_alpha", 0)
|
|
72
|
-
kde_kwargs.setdefault("contour_kwargs", {})
|
|
73
|
-
kde_kwargs["contour_kwargs"].setdefault("line_color", "black")
|
|
74
|
-
kde_kwargs["contour_kwargs"].setdefault("line_alpha", 1)
|
|
75
|
-
|
|
76
|
-
if reference_values:
|
|
77
|
-
difference = set(flat_var_names).difference(set(reference_values.keys()))
|
|
78
|
-
|
|
79
|
-
if difference:
|
|
80
|
-
warnings.warn(
|
|
81
|
-
"Argument reference_values does not include reference value for: {}".format(
|
|
82
|
-
", ".join(difference)
|
|
83
|
-
),
|
|
84
|
-
UserWarning,
|
|
85
|
-
)
|
|
86
|
-
|
|
87
|
-
reference_values_kwargs = _init_kwargs_dict(reference_values_kwargs)
|
|
88
|
-
reference_values_kwargs.setdefault("marker", "circle")
|
|
89
|
-
reference_values_kwargs.setdefault("line_color", "black")
|
|
90
|
-
reference_values_kwargs.setdefault("fill_color", vectorized_to_hex("C2"))
|
|
91
|
-
reference_values_kwargs.setdefault("line_width", 1)
|
|
92
|
-
reference_values_kwargs.setdefault("size", 10)
|
|
93
|
-
|
|
94
|
-
divergences_kwargs = _init_kwargs_dict(divergences_kwargs)
|
|
95
|
-
divergences_kwargs.setdefault("marker", "circle")
|
|
96
|
-
divergences_kwargs.setdefault("line_color", "black")
|
|
97
|
-
divergences_kwargs.setdefault("fill_color", vectorized_to_hex("C1"))
|
|
98
|
-
divergences_kwargs.setdefault("line_width", 1)
|
|
99
|
-
divergences_kwargs.setdefault("size", 10)
|
|
100
|
-
|
|
101
|
-
dpi = backend_kwargs.pop("dpi")
|
|
102
|
-
max_plots = (
|
|
103
|
-
numvars**2 if rcParams["plot.max_subplots"] is None else rcParams["plot.max_subplots"]
|
|
104
|
-
)
|
|
105
|
-
vars_to_plot = np.sum(np.arange(numvars).cumsum() < max_plots)
|
|
106
|
-
if vars_to_plot < numvars:
|
|
107
|
-
warnings.warn(
|
|
108
|
-
"rcParams['plot.max_subplots'] ({max_plots}) is smaller than the number "
|
|
109
|
-
"of resulting pair plots with these variables, generating only a "
|
|
110
|
-
"{side}x{side} grid".format(max_plots=max_plots, side=vars_to_plot),
|
|
111
|
-
UserWarning,
|
|
112
|
-
)
|
|
113
|
-
numvars = vars_to_plot
|
|
114
|
-
|
|
115
|
-
if numvars == 2:
|
|
116
|
-
offset = 1
|
|
117
|
-
else:
|
|
118
|
-
offset = 2
|
|
119
|
-
(figsize, _, _, _, _, markersize) = _scale_fig_size(
|
|
120
|
-
figsize, textsize, numvars - offset, numvars - offset
|
|
121
|
-
)
|
|
122
|
-
|
|
123
|
-
point_estimate_marker_kwargs = _init_kwargs_dict(point_estimate_marker_kwargs)
|
|
124
|
-
point_estimate_marker_kwargs.setdefault("marker", "square")
|
|
125
|
-
point_estimate_marker_kwargs.setdefault("size", markersize)
|
|
126
|
-
point_estimate_marker_kwargs.setdefault("color", "black")
|
|
127
|
-
point_estimate_kwargs.setdefault("line_color", "black")
|
|
128
|
-
point_estimate_kwargs.setdefault("line_width", 2)
|
|
129
|
-
point_estimate_kwargs.setdefault("line_dash", "solid")
|
|
130
|
-
|
|
131
|
-
tmp_flat_var_names = None
|
|
132
|
-
if len(flat_var_names) == len(list(set(flat_var_names))):
|
|
133
|
-
source_dict = dict(zip(flat_var_names, [list(post[-1].flatten()) for post in plotters]))
|
|
134
|
-
else:
|
|
135
|
-
tmp_flat_var_names = [f"{name}__{str(uuid4())}" for name in flat_var_names]
|
|
136
|
-
source_dict = dict(zip(tmp_flat_var_names, [list(post[-1].flatten()) for post in plotters]))
|
|
137
|
-
if divergences:
|
|
138
|
-
divergenve_name = f"divergences_{str(uuid4())}"
|
|
139
|
-
source_dict[divergenve_name] = np.array(diverging_mask).astype(bool).astype(int).astype(str)
|
|
140
|
-
|
|
141
|
-
source = ColumnDataSource(data=source_dict)
|
|
142
|
-
|
|
143
|
-
if divergences:
|
|
144
|
-
source_nondiv = CDSView(filter=GroupFilter(column_name=divergenve_name, group="0"))
|
|
145
|
-
source_div = CDSView(filter=GroupFilter(column_name=divergenve_name, group="1"))
|
|
146
|
-
|
|
147
|
-
def get_width_and_height(jointplot, rotate):
|
|
148
|
-
"""Compute subplots dimensions for two or more variables."""
|
|
149
|
-
if jointplot:
|
|
150
|
-
if rotate:
|
|
151
|
-
width = int(figsize[0] / (numvars - 1) + 2 * dpi)
|
|
152
|
-
height = int(figsize[1] / (numvars - 1) * dpi)
|
|
153
|
-
else:
|
|
154
|
-
width = int(figsize[0] / (numvars - 1) * dpi)
|
|
155
|
-
height = int(figsize[1] / (numvars - 1) + 2 * dpi)
|
|
156
|
-
else:
|
|
157
|
-
width = int(figsize[0] / (numvars - 1) * dpi)
|
|
158
|
-
height = int(figsize[1] / (numvars - 1) * dpi)
|
|
159
|
-
return width, height
|
|
160
|
-
|
|
161
|
-
if marginals:
|
|
162
|
-
marginals_offset = 0
|
|
163
|
-
else:
|
|
164
|
-
marginals_offset = 1
|
|
165
|
-
|
|
166
|
-
if ax is None:
|
|
167
|
-
ax = []
|
|
168
|
-
backend_kwargs.setdefault("width", int(figsize[0] / (numvars - 1) * dpi))
|
|
169
|
-
backend_kwargs.setdefault("height", int(figsize[1] / (numvars - 1) * dpi))
|
|
170
|
-
for row in range(numvars - marginals_offset):
|
|
171
|
-
row_ax = []
|
|
172
|
-
var1 = (
|
|
173
|
-
flat_var_names[row + marginals_offset]
|
|
174
|
-
if tmp_flat_var_names is None
|
|
175
|
-
else tmp_flat_var_names[row + marginals_offset]
|
|
176
|
-
)
|
|
177
|
-
for col in range(numvars - marginals_offset):
|
|
178
|
-
var2 = (
|
|
179
|
-
flat_var_names[col] if tmp_flat_var_names is None else tmp_flat_var_names[col]
|
|
180
|
-
)
|
|
181
|
-
backend_kwargs_copy = backend_kwargs.copy()
|
|
182
|
-
if "scatter" in kind:
|
|
183
|
-
tooltips = [
|
|
184
|
-
(var2, f"@{{{var2}}}"),
|
|
185
|
-
(var1, f"@{{{var1}}}"),
|
|
186
|
-
]
|
|
187
|
-
backend_kwargs_copy.setdefault("tooltips", tooltips)
|
|
188
|
-
else:
|
|
189
|
-
tooltips = None
|
|
190
|
-
if row < col:
|
|
191
|
-
row_ax.append(None)
|
|
192
|
-
else:
|
|
193
|
-
jointplot = row == col and numvars == 2 and marginals
|
|
194
|
-
rotate = col == 1
|
|
195
|
-
width, height = get_width_and_height(jointplot, rotate)
|
|
196
|
-
if jointplot:
|
|
197
|
-
ax_ = bkp.figure(width=width, height=height, tooltips=tooltips)
|
|
198
|
-
else:
|
|
199
|
-
ax_ = bkp.figure(**backend_kwargs_copy)
|
|
200
|
-
row_ax.append(ax_)
|
|
201
|
-
ax.append(row_ax)
|
|
202
|
-
ax = np.array(ax)
|
|
203
|
-
else:
|
|
204
|
-
assert ax.shape == (numvars - marginals_offset, numvars - marginals_offset)
|
|
205
|
-
|
|
206
|
-
# pylint: disable=too-many-nested-blocks
|
|
207
|
-
for i in range(0, numvars - marginals_offset):
|
|
208
|
-
var1 = flat_var_names[i] if tmp_flat_var_names is None else tmp_flat_var_names[i]
|
|
209
|
-
|
|
210
|
-
for j in range(0, numvars - marginals_offset):
|
|
211
|
-
var2 = (
|
|
212
|
-
flat_var_names[j + marginals_offset]
|
|
213
|
-
if tmp_flat_var_names is None
|
|
214
|
-
else tmp_flat_var_names[j + marginals_offset]
|
|
215
|
-
)
|
|
216
|
-
|
|
217
|
-
if j == i and marginals:
|
|
218
|
-
rotate = numvars == 2 and j == 1
|
|
219
|
-
var1_dist = plotters[i][-1].flatten()
|
|
220
|
-
plot_dist(
|
|
221
|
-
var1_dist,
|
|
222
|
-
ax=ax[j, i],
|
|
223
|
-
show=False,
|
|
224
|
-
backend="bokeh",
|
|
225
|
-
rotated=rotate,
|
|
226
|
-
**marginal_kwargs,
|
|
227
|
-
)
|
|
228
|
-
|
|
229
|
-
ax[j, i].xaxis.axis_label = flat_var_labels[i]
|
|
230
|
-
ax[j, i].yaxis.axis_label = flat_var_labels[j + marginals_offset]
|
|
231
|
-
|
|
232
|
-
elif j + marginals_offset > i:
|
|
233
|
-
if "scatter" in kind:
|
|
234
|
-
if divergences:
|
|
235
|
-
ax[j, i].scatter(
|
|
236
|
-
var1, var2, marker="circle", source=source, view=source_nondiv
|
|
237
|
-
)
|
|
238
|
-
else:
|
|
239
|
-
ax[j, i].scatter(var1, var2, marker="circle", source=source)
|
|
240
|
-
|
|
241
|
-
if "kde" in kind:
|
|
242
|
-
var1_kde = plotters[i][-1].flatten()
|
|
243
|
-
var2_kde = plotters[j + marginals_offset][-1].flatten()
|
|
244
|
-
plot_kde(
|
|
245
|
-
var1_kde,
|
|
246
|
-
var2_kde,
|
|
247
|
-
ax=ax[j, i],
|
|
248
|
-
backend="bokeh",
|
|
249
|
-
backend_kwargs={},
|
|
250
|
-
show=False,
|
|
251
|
-
**deepcopy(kde_kwargs),
|
|
252
|
-
)
|
|
253
|
-
|
|
254
|
-
if "hexbin" in kind:
|
|
255
|
-
var1_hexbin = plotters[i][-1].flatten()
|
|
256
|
-
var2_hexbin = plotters[j + marginals_offset][-1].flatten()
|
|
257
|
-
ax[j, i].grid.visible = False
|
|
258
|
-
ax[j, i].hexbin(
|
|
259
|
-
var1_hexbin,
|
|
260
|
-
var2_hexbin,
|
|
261
|
-
**hexbin_kwargs,
|
|
262
|
-
)
|
|
263
|
-
|
|
264
|
-
if divergences:
|
|
265
|
-
ax[j, i].scatter(
|
|
266
|
-
var1,
|
|
267
|
-
var2,
|
|
268
|
-
source=source,
|
|
269
|
-
view=source_div,
|
|
270
|
-
**divergences_kwargs,
|
|
271
|
-
)
|
|
272
|
-
|
|
273
|
-
if point_estimate:
|
|
274
|
-
var1_pe = plotters[i][-1].flatten()
|
|
275
|
-
var2_pe = plotters[j][-1].flatten()
|
|
276
|
-
pe_x = calculate_point_estimate(point_estimate, var1_pe)
|
|
277
|
-
pe_y = calculate_point_estimate(point_estimate, var2_pe)
|
|
278
|
-
ax[j, i].scatter(pe_x, pe_y, **point_estimate_marker_kwargs)
|
|
279
|
-
|
|
280
|
-
ax_hline = Span(
|
|
281
|
-
location=pe_y,
|
|
282
|
-
dimension="width",
|
|
283
|
-
**point_estimate_kwargs,
|
|
284
|
-
)
|
|
285
|
-
ax_vline = Span(
|
|
286
|
-
location=pe_x,
|
|
287
|
-
dimension="height",
|
|
288
|
-
**point_estimate_kwargs,
|
|
289
|
-
)
|
|
290
|
-
ax[j, i].add_layout(ax_hline)
|
|
291
|
-
ax[j, i].add_layout(ax_vline)
|
|
292
|
-
|
|
293
|
-
if marginals:
|
|
294
|
-
ax[j - 1, i].add_layout(ax_vline)
|
|
295
|
-
|
|
296
|
-
pe_last = calculate_point_estimate(point_estimate, plotters[-1][-1])
|
|
297
|
-
ax_pe_vline = Span(
|
|
298
|
-
location=pe_last,
|
|
299
|
-
dimension="height",
|
|
300
|
-
**point_estimate_kwargs,
|
|
301
|
-
)
|
|
302
|
-
ax[-1, -1].add_layout(ax_pe_vline)
|
|
303
|
-
|
|
304
|
-
if numvars == 2:
|
|
305
|
-
ax_pe_hline = Span(
|
|
306
|
-
location=pe_last,
|
|
307
|
-
dimension="width",
|
|
308
|
-
**point_estimate_kwargs,
|
|
309
|
-
)
|
|
310
|
-
ax[-1, -1].add_layout(ax_pe_hline)
|
|
311
|
-
|
|
312
|
-
if reference_values:
|
|
313
|
-
x_name = flat_var_names[j + marginals_offset]
|
|
314
|
-
y_name = flat_var_names[i]
|
|
315
|
-
if (x_name not in difference) and (y_name not in difference):
|
|
316
|
-
ax[j, i].scatter(
|
|
317
|
-
np.array(reference_values[y_name])[flat_ref_slices[i]],
|
|
318
|
-
np.array(reference_values[x_name])[
|
|
319
|
-
flat_ref_slices[j + marginals_offset]
|
|
320
|
-
],
|
|
321
|
-
**reference_values_kwargs,
|
|
322
|
-
)
|
|
323
|
-
ax[j, i].xaxis.axis_label = flat_var_labels[i]
|
|
324
|
-
ax[j, i].yaxis.axis_label = flat_var_labels[j + marginals_offset]
|
|
325
|
-
|
|
326
|
-
show_layout(ax, show)
|
|
327
|
-
|
|
328
|
-
return ax
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
"""Bokeh Parallel coordinates plot."""
|
|
2
|
-
|
|
3
|
-
import numpy as np
|
|
4
|
-
from bokeh.models import DataRange1d
|
|
5
|
-
from bokeh.models.tickers import FixedTicker
|
|
6
|
-
|
|
7
|
-
from ...plot_utils import _scale_fig_size
|
|
8
|
-
from .. import show_layout
|
|
9
|
-
from . import backend_kwarg_defaults, create_axes_grid
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
def plot_parallel(
|
|
13
|
-
ax,
|
|
14
|
-
colornd, # pylint: disable=unused-argument
|
|
15
|
-
colord, # pylint: disable=unused-argument
|
|
16
|
-
shadend, # pylint: disable=unused-argument
|
|
17
|
-
diverging_mask,
|
|
18
|
-
posterior,
|
|
19
|
-
textsize,
|
|
20
|
-
var_names,
|
|
21
|
-
legend, # pylint: disable=unused-argument
|
|
22
|
-
figsize,
|
|
23
|
-
backend_kwargs,
|
|
24
|
-
backend_config,
|
|
25
|
-
show,
|
|
26
|
-
):
|
|
27
|
-
"""Bokeh parallel plot."""
|
|
28
|
-
if backend_config is None:
|
|
29
|
-
backend_config = {}
|
|
30
|
-
|
|
31
|
-
backend_config = {
|
|
32
|
-
**backend_kwarg_defaults(
|
|
33
|
-
("bounds_x_range", "plot.bokeh.bounds_x_range"),
|
|
34
|
-
("bounds_y_range", "plot.bokeh.bounds_y_range"),
|
|
35
|
-
),
|
|
36
|
-
**backend_config,
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
if backend_kwargs is None:
|
|
40
|
-
backend_kwargs = {}
|
|
41
|
-
|
|
42
|
-
backend_kwargs = {
|
|
43
|
-
**backend_kwarg_defaults(),
|
|
44
|
-
**backend_kwargs,
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
figsize, *_ = _scale_fig_size(figsize, textsize, 1, 1)
|
|
48
|
-
|
|
49
|
-
if ax is None:
|
|
50
|
-
ax = create_axes_grid(
|
|
51
|
-
1,
|
|
52
|
-
figsize=figsize,
|
|
53
|
-
squeeze=True,
|
|
54
|
-
backend_kwargs=backend_kwargs,
|
|
55
|
-
)
|
|
56
|
-
|
|
57
|
-
non_div = list(posterior[:, ~diverging_mask].T)
|
|
58
|
-
x_non_div = [list(range(len(non_div[0]))) for _ in range(len(non_div))]
|
|
59
|
-
|
|
60
|
-
ax.multi_line(
|
|
61
|
-
x_non_div,
|
|
62
|
-
non_div,
|
|
63
|
-
line_color="black",
|
|
64
|
-
line_alpha=0.05,
|
|
65
|
-
)
|
|
66
|
-
|
|
67
|
-
if np.any(diverging_mask):
|
|
68
|
-
div = list(posterior[:, diverging_mask].T)
|
|
69
|
-
x_non_div = [list(range(len(div[0]))) for _ in range(len(div))]
|
|
70
|
-
ax.multi_line(x_non_div, div, color="lime", line_width=1, line_alpha=0.5)
|
|
71
|
-
|
|
72
|
-
ax.xaxis.ticker = FixedTicker(ticks=list(range(len(var_names))))
|
|
73
|
-
ax.xaxis.major_label_overrides = dict(zip(map(str, range(len(var_names))), map(str, var_names)))
|
|
74
|
-
ax.xaxis.major_label_orientation = np.pi / 2
|
|
75
|
-
|
|
76
|
-
ax.x_range = DataRange1d(bounds=backend_config["bounds_x_range"], min_interval=2)
|
|
77
|
-
ax.y_range = DataRange1d(bounds=backend_config["bounds_y_range"], min_interval=5)
|
|
78
|
-
|
|
79
|
-
show_layout(ax, show)
|
|
80
|
-
|
|
81
|
-
return ax
|