arviz 0.22.0__tar.gz → 0.23.0__tar.gz
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-0.22.0 → arviz-0.23.0}/CHANGELOG.md +8 -0
- {arviz-0.22.0 → arviz-0.23.0}/PKG-INFO +36 -3
- {arviz-0.22.0 → arviz-0.23.0}/arviz/__init__.py +42 -2
- {arviz-0.22.0 → arviz-0.23.0}/arviz/data/converters.py +11 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/data/inference_data.py +11 -7
- {arviz-0.22.0 → arviz-0.23.0}/arviz/data/io_numpyro.py +4 -1
- {arviz-0.22.0 → arviz-0.23.0}/arviz/data/io_pyjags.py +1 -1
- {arviz-0.22.0 → arviz-0.23.0}/arviz/plots/bpvplot.py +1 -1
- {arviz-0.22.0 → arviz-0.23.0}/arviz/plots/dotplot.py +2 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/plots/forestplot.py +16 -4
- {arviz-0.22.0 → arviz-0.23.0}/arviz/plots/ppcplot.py +1 -1
- arviz-0.23.0/arviz/preview.py +58 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/rcparams.py +2 -2
- {arviz-0.22.0 → arviz-0.23.0}/arviz/stats/stats.py +12 -27
- {arviz-0.22.0 → arviz-0.23.0}/arviz/tests/base_tests/test_data.py +25 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/tests/base_tests/test_plots_matplotlib.py +17 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/tests/base_tests/test_stats_ecdf_utils.py +2 -2
- {arviz-0.22.0 → arviz-0.23.0}/arviz/tests/external_tests/test_data_numpyro.py +24 -1
- {arviz-0.22.0 → arviz-0.23.0}/arviz.egg-info/PKG-INFO +36 -3
- arviz-0.22.0/arviz/preview.py +0 -48
- {arviz-0.22.0 → arviz-0.23.0}/CODE_OF_CONDUCT.md +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/CONTRIBUTING.md +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/GOVERNANCE.md +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/LICENSE +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/MANIFEST.in +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/README.md +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/data/__init__.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/data/base.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/data/datasets.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/data/example_data/code/radon/radon.json +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/data/example_data/data/centered_eight.nc +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/data/example_data/data/non_centered_eight.nc +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/data/example_data/data_local.json +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/data/example_data/data_remote.json +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/data/io_beanmachine.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/data/io_cmdstan.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/data/io_cmdstanpy.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/data/io_datatree.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/data/io_dict.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/data/io_emcee.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/data/io_json.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/data/io_netcdf.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/data/io_pyro.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/data/io_pystan.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/data/io_zarr.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/data/utils.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/labels.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/plots/__init__.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/plots/autocorrplot.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/plots/backends/__init__.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/plots/backends/bokeh/__init__.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/plots/backends/bokeh/autocorrplot.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/plots/backends/bokeh/bfplot.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/plots/backends/bokeh/bpvplot.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/plots/backends/bokeh/compareplot.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/plots/backends/bokeh/densityplot.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/plots/backends/bokeh/distcomparisonplot.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/plots/backends/bokeh/distplot.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/plots/backends/bokeh/dotplot.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/plots/backends/bokeh/ecdfplot.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/plots/backends/bokeh/elpdplot.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/plots/backends/bokeh/energyplot.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/plots/backends/bokeh/essplot.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/plots/backends/bokeh/forestplot.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/plots/backends/bokeh/hdiplot.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/plots/backends/bokeh/kdeplot.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/plots/backends/bokeh/khatplot.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/plots/backends/bokeh/lmplot.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/plots/backends/bokeh/loopitplot.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/plots/backends/bokeh/mcseplot.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/plots/backends/bokeh/pairplot.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/plots/backends/bokeh/parallelplot.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/plots/backends/bokeh/posteriorplot.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/plots/backends/bokeh/ppcplot.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/plots/backends/bokeh/rankplot.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/plots/backends/bokeh/separationplot.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/plots/backends/bokeh/traceplot.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/plots/backends/bokeh/violinplot.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/plots/backends/matplotlib/__init__.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/plots/backends/matplotlib/autocorrplot.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/plots/backends/matplotlib/bfplot.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/plots/backends/matplotlib/bpvplot.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/plots/backends/matplotlib/compareplot.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/plots/backends/matplotlib/densityplot.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/plots/backends/matplotlib/distcomparisonplot.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/plots/backends/matplotlib/distplot.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/plots/backends/matplotlib/dotplot.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/plots/backends/matplotlib/ecdfplot.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/plots/backends/matplotlib/elpdplot.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/plots/backends/matplotlib/energyplot.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/plots/backends/matplotlib/essplot.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/plots/backends/matplotlib/forestplot.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/plots/backends/matplotlib/hdiplot.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/plots/backends/matplotlib/kdeplot.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/plots/backends/matplotlib/khatplot.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/plots/backends/matplotlib/lmplot.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/plots/backends/matplotlib/loopitplot.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/plots/backends/matplotlib/mcseplot.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/plots/backends/matplotlib/pairplot.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/plots/backends/matplotlib/parallelplot.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/plots/backends/matplotlib/posteriorplot.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/plots/backends/matplotlib/ppcplot.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/plots/backends/matplotlib/rankplot.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/plots/backends/matplotlib/separationplot.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/plots/backends/matplotlib/traceplot.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/plots/backends/matplotlib/tsplot.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/plots/backends/matplotlib/violinplot.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/plots/bfplot.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/plots/compareplot.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/plots/densityplot.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/plots/distcomparisonplot.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/plots/distplot.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/plots/ecdfplot.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/plots/elpdplot.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/plots/energyplot.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/plots/essplot.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/plots/hdiplot.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/plots/kdeplot.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/plots/khatplot.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/plots/lmplot.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/plots/loopitplot.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/plots/mcseplot.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/plots/pairplot.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/plots/parallelplot.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/plots/plot_utils.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/plots/posteriorplot.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/plots/rankplot.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/plots/separationplot.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/plots/styles/arviz-bluish.mplstyle +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/plots/styles/arviz-brownish.mplstyle +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/plots/styles/arviz-colors.mplstyle +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/plots/styles/arviz-cyanish.mplstyle +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/plots/styles/arviz-darkgrid.mplstyle +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/plots/styles/arviz-doc.mplstyle +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/plots/styles/arviz-docgrid.mplstyle +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/plots/styles/arviz-grayscale.mplstyle +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/plots/styles/arviz-greenish.mplstyle +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/plots/styles/arviz-orangish.mplstyle +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/plots/styles/arviz-plasmish.mplstyle +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/plots/styles/arviz-purplish.mplstyle +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/plots/styles/arviz-redish.mplstyle +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/plots/styles/arviz-royish.mplstyle +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/plots/styles/arviz-viridish.mplstyle +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/plots/styles/arviz-white.mplstyle +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/plots/styles/arviz-whitegrid.mplstyle +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/plots/traceplot.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/plots/tsplot.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/plots/violinplot.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/py.typed +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/sel_utils.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/static/css/style.css +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/static/html/icons-svg-inline.html +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/stats/__init__.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/stats/density_utils.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/stats/diagnostics.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/stats/ecdf_utils.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/stats/stats_refitting.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/stats/stats_utils.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/tests/__init__.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/tests/base_tests/__init__.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/tests/base_tests/test_data_zarr.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/tests/base_tests/test_diagnostics.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/tests/base_tests/test_diagnostics_numba.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/tests/base_tests/test_helpers.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/tests/base_tests/test_labels.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/tests/base_tests/test_plot_utils.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/tests/base_tests/test_plots_bokeh.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/tests/base_tests/test_rcparams.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/tests/base_tests/test_stats.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/tests/base_tests/test_stats_numba.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/tests/base_tests/test_stats_utils.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/tests/base_tests/test_utils.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/tests/base_tests/test_utils_numba.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/tests/conftest.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/tests/external_tests/__init__.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/tests/external_tests/test_data_beanmachine.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/tests/external_tests/test_data_cmdstan.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/tests/external_tests/test_data_cmdstanpy.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/tests/external_tests/test_data_emcee.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/tests/external_tests/test_data_pyjags.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/tests/external_tests/test_data_pyro.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/tests/external_tests/test_data_pystan.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/tests/helpers.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/utils.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/wrappers/__init__.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/wrappers/base.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/wrappers/wrap_pymc.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz/wrappers/wrap_stan.py +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz.egg-info/SOURCES.txt +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz.egg-info/dependency_links.txt +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz.egg-info/requires.txt +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/arviz.egg-info/top_level.txt +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/pyproject.toml +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/requirements-dev.txt +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/requirements-docs.txt +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/requirements-external.txt +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/requirements-optional.txt +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/requirements-test.txt +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/requirements.txt +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/setup.cfg +0 -0
- {arviz-0.22.0 → arviz-0.23.0}/setup.py +0 -0
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## v0.23.0 (2025 Des 9)
|
|
4
|
+
|
|
5
|
+
### Maintenance and fixes
|
|
6
|
+
- Fix numpyro jax incompatibility. ([2465](https://github.com/arviz-devs/arviz/pull/2465))
|
|
7
|
+
- Avoid closing unloaded files in `from_netcdf()` ([2463](https://github.com/arviz-devs/arviz/issues/2463))
|
|
8
|
+
- Fix sign error in lp parsed in from_numpyro ([2468](https://github.com/arviz-devs/arviz/issues/2468))
|
|
9
|
+
- Fix attrs persistance in idata-datatree conversions ([2476](https://github.com/arviz-devs/arviz/issues/2476))
|
|
10
|
+
|
|
3
11
|
## v0.22.0 (2025 Jul 9)
|
|
4
12
|
|
|
5
13
|
### New features
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: arviz
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.23.0
|
|
4
4
|
Summary: Exploratory analysis of Bayesian models
|
|
5
5
|
Home-page: http://github.com/arviz-devs/arviz
|
|
6
6
|
Author: ArviZ Developers
|
|
@@ -20,9 +20,42 @@ Classifier: Topic :: Scientific/Engineering :: Visualization
|
|
|
20
20
|
Classifier: Topic :: Scientific/Engineering :: Mathematics
|
|
21
21
|
Requires-Python: >=3.10
|
|
22
22
|
Description-Content-Type: text/markdown
|
|
23
|
+
License-File: LICENSE
|
|
24
|
+
Requires-Dist: setuptools>=60.0.0
|
|
25
|
+
Requires-Dist: matplotlib>=3.8
|
|
26
|
+
Requires-Dist: numpy>=1.26.0
|
|
27
|
+
Requires-Dist: scipy>=1.11.0
|
|
28
|
+
Requires-Dist: packaging
|
|
29
|
+
Requires-Dist: pandas>=2.1.0
|
|
30
|
+
Requires-Dist: xarray>=2023.7.0
|
|
31
|
+
Requires-Dist: h5netcdf>=1.0.2
|
|
32
|
+
Requires-Dist: typing_extensions>=4.1.0
|
|
33
|
+
Requires-Dist: xarray-einstats>=0.3
|
|
23
34
|
Provides-Extra: all
|
|
35
|
+
Requires-Dist: numba; extra == "all"
|
|
36
|
+
Requires-Dist: netcdf4; extra == "all"
|
|
37
|
+
Requires-Dist: bokeh>=3; extra == "all"
|
|
38
|
+
Requires-Dist: contourpy; extra == "all"
|
|
39
|
+
Requires-Dist: ujson; extra == "all"
|
|
40
|
+
Requires-Dist: dask[distributed]; extra == "all"
|
|
41
|
+
Requires-Dist: zarr<3,>=2.5.0; extra == "all"
|
|
42
|
+
Requires-Dist: xarray>=2024.11.0; extra == "all"
|
|
43
|
+
Requires-Dist: dm-tree>=0.1.8; extra == "all"
|
|
24
44
|
Provides-Extra: preview
|
|
25
|
-
|
|
45
|
+
Requires-Dist: arviz-base[h5netcdf]; extra == "preview"
|
|
46
|
+
Requires-Dist: arviz-stats[xarray]; extra == "preview"
|
|
47
|
+
Requires-Dist: arviz-plots; extra == "preview"
|
|
48
|
+
Dynamic: author
|
|
49
|
+
Dynamic: classifier
|
|
50
|
+
Dynamic: description
|
|
51
|
+
Dynamic: description-content-type
|
|
52
|
+
Dynamic: home-page
|
|
53
|
+
Dynamic: license
|
|
54
|
+
Dynamic: license-file
|
|
55
|
+
Dynamic: provides-extra
|
|
56
|
+
Dynamic: requires-dist
|
|
57
|
+
Dynamic: requires-python
|
|
58
|
+
Dynamic: summary
|
|
26
59
|
|
|
27
60
|
<img src="https://raw.githubusercontent.com/arviz-devs/arviz-project/main/arviz_logos/ArviZ.png#gh-light-mode-only" width=200></img>
|
|
28
61
|
<img src="https://raw.githubusercontent.com/arviz-devs/arviz-project/main/arviz_logos/ArviZ_white.png#gh-dark-mode-only" width=200></img>
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
# pylint: disable=wildcard-import,invalid-name,wrong-import-position
|
|
2
2
|
"""ArviZ is a library for exploratory analysis of Bayesian models."""
|
|
3
|
-
__version__ = "0.
|
|
3
|
+
__version__ = "0.23.0"
|
|
4
4
|
|
|
5
5
|
import logging
|
|
6
6
|
import os
|
|
7
|
+
import re
|
|
7
8
|
|
|
8
9
|
from matplotlib.colors import LinearSegmentedColormap
|
|
9
10
|
from matplotlib.pyplot import style
|
|
@@ -11,6 +12,45 @@ import matplotlib as mpl
|
|
|
11
12
|
from packaging import version
|
|
12
13
|
|
|
13
14
|
|
|
15
|
+
def _warn_once_per_day():
|
|
16
|
+
from .preview import info
|
|
17
|
+
|
|
18
|
+
# skip warning if all 3 arviz subpackages are already installed
|
|
19
|
+
pat = re.compile(r"arviz_(base|stats|plots) available")
|
|
20
|
+
if len(pat.findall(info)) == 3:
|
|
21
|
+
return
|
|
22
|
+
|
|
23
|
+
import datetime
|
|
24
|
+
from warnings import warn
|
|
25
|
+
from pathlib import Path
|
|
26
|
+
|
|
27
|
+
warning_dir = Path.home() / "arviz_data"
|
|
28
|
+
warning_dir.mkdir(exist_ok=True)
|
|
29
|
+
|
|
30
|
+
stamp_file = warning_dir / "daily_warning"
|
|
31
|
+
today = datetime.date.today()
|
|
32
|
+
|
|
33
|
+
if stamp_file.exists():
|
|
34
|
+
last_date = datetime.date.fromisoformat(stamp_file.read_text().strip())
|
|
35
|
+
else:
|
|
36
|
+
last_date = None
|
|
37
|
+
|
|
38
|
+
if last_date != today:
|
|
39
|
+
warn(
|
|
40
|
+
"\nArviZ is undergoing a major refactor to improve flexibility and extensibility "
|
|
41
|
+
"while maintaining a user-friendly interface."
|
|
42
|
+
"\nSome upcoming changes may be backward incompatible."
|
|
43
|
+
"\nFor details and migration guidance, visit: "
|
|
44
|
+
"https://python.arviz.org/en/latest/user_guide/migration_guide.html",
|
|
45
|
+
FutureWarning,
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
stamp_file.write_text(today.isoformat())
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
_warn_once_per_day()
|
|
52
|
+
|
|
53
|
+
|
|
14
54
|
class Logger(logging.Logger):
|
|
15
55
|
"""Override Logger to avoid repeated messages."""
|
|
16
56
|
|
|
@@ -333,4 +373,4 @@ except ModuleNotFoundError:
|
|
|
333
373
|
|
|
334
374
|
|
|
335
375
|
# clean namespace
|
|
336
|
-
del os, logging, LinearSegmentedColormap, Logger, mpl
|
|
376
|
+
del os, re, logging, version, LinearSegmentedColormap, Logger, mpl
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import numpy as np
|
|
4
4
|
import xarray as xr
|
|
5
|
+
import pandas as pd
|
|
5
6
|
|
|
6
7
|
try:
|
|
7
8
|
from tree import is_nested
|
|
@@ -44,6 +45,8 @@ def convert_to_inference_data(obj, *, group="posterior", coords=None, dims=None,
|
|
|
44
45
|
| dict: creates an xarray dataset as the only group
|
|
45
46
|
| numpy array: creates an xarray dataset as the only group, gives the
|
|
46
47
|
array an arbitrary name
|
|
48
|
+
| object with __array__: converts to numpy array, then creates an xarray dataset as
|
|
49
|
+
the only group, gives the array an arbitrary name
|
|
47
50
|
group : str
|
|
48
51
|
If `obj` is a dict or numpy array, assigns the resulting xarray
|
|
49
52
|
dataset to this group. Default: "posterior".
|
|
@@ -115,6 +118,13 @@ def convert_to_inference_data(obj, *, group="posterior", coords=None, dims=None,
|
|
|
115
118
|
dataset = dict_to_dataset(obj, coords=coords, dims=dims)
|
|
116
119
|
elif isinstance(obj, np.ndarray):
|
|
117
120
|
dataset = dict_to_dataset({"x": obj}, coords=coords, dims=dims)
|
|
121
|
+
elif (
|
|
122
|
+
hasattr(obj, "__array__")
|
|
123
|
+
and callable(getattr(obj, "__array__"))
|
|
124
|
+
and (not isinstance(obj, pd.DataFrame))
|
|
125
|
+
):
|
|
126
|
+
obj = obj.__array__()
|
|
127
|
+
dataset = dict_to_dataset({"x": obj}, coords=coords, dims=dims)
|
|
118
128
|
elif isinstance(obj, (list, tuple)) and isinstance(obj[0], str) and obj[0].endswith(".csv"):
|
|
119
129
|
if group == "sample_stats":
|
|
120
130
|
kwargs["posterior"] = kwargs.pop(group)
|
|
@@ -129,6 +139,7 @@ def convert_to_inference_data(obj, *, group="posterior", coords=None, dims=None,
|
|
|
129
139
|
"pytree (if 'dm-tree' is installed)",
|
|
130
140
|
"netcdf filename",
|
|
131
141
|
"numpy array",
|
|
142
|
+
"object with __array__",
|
|
132
143
|
"pystan fit",
|
|
133
144
|
"emcee fit",
|
|
134
145
|
"pyro mcmc fit",
|
|
@@ -430,11 +430,12 @@ class InferenceData(Mapping[str, xr.Dataset]):
|
|
|
430
430
|
if re.search(key, group):
|
|
431
431
|
group_kws = kws
|
|
432
432
|
group_kws.setdefault("engine", engine)
|
|
433
|
-
|
|
434
|
-
|
|
433
|
+
data = xr.open_dataset(filename, group=f"{base_group}/{group}", **group_kws)
|
|
434
|
+
if rcParams["data.load"] == "eager":
|
|
435
|
+
with data:
|
|
435
436
|
groups[group] = data.load()
|
|
436
|
-
|
|
437
|
-
|
|
437
|
+
else:
|
|
438
|
+
groups[group] = data
|
|
438
439
|
|
|
439
440
|
with xr.open_dataset(filename, engine=engine, group=base_group) as data:
|
|
440
441
|
attrs.update(data.load().attrs)
|
|
@@ -540,7 +541,9 @@ class InferenceData(Mapping[str, xr.Dataset]):
|
|
|
540
541
|
"xarray must be have DataTree in order to use InferenceData.to_datatree. "
|
|
541
542
|
"Update to xarray>=2024.11.0"
|
|
542
543
|
) from err
|
|
543
|
-
|
|
544
|
+
dt = DataTree.from_dict({group: ds for group, ds in self.items()})
|
|
545
|
+
dt.attrs = self.attrs
|
|
546
|
+
return dt
|
|
544
547
|
|
|
545
548
|
@staticmethod
|
|
546
549
|
def from_datatree(datatree):
|
|
@@ -551,7 +554,8 @@ class InferenceData(Mapping[str, xr.Dataset]):
|
|
|
551
554
|
datatree : DataTree
|
|
552
555
|
"""
|
|
553
556
|
return InferenceData(
|
|
554
|
-
|
|
557
|
+
attrs=datatree.attrs,
|
|
558
|
+
**{group: child.to_dataset() for group, child in datatree.children.items()},
|
|
555
559
|
)
|
|
556
560
|
|
|
557
561
|
def to_dict(self, groups=None, filter_groups=None):
|
|
@@ -811,7 +815,7 @@ class InferenceData(Mapping[str, xr.Dataset]):
|
|
|
811
815
|
if version.parse(zarr.__version__) >= version.parse("3.0.0.dev0"):
|
|
812
816
|
raise ImportError(
|
|
813
817
|
"Found zarr>=3, which is not supported by ArviZ. Instead, you can use "
|
|
814
|
-
"'dt =
|
|
818
|
+
"'dt = InferenceData.to_datatree' followed by 'dt.to_zarr()' "
|
|
815
819
|
"(needs xarray>=2024.11.0)"
|
|
816
820
|
)
|
|
817
821
|
|
|
@@ -241,7 +241,10 @@ class NumPyroConverter:
|
|
|
241
241
|
continue
|
|
242
242
|
name = rename_key.get(stat, stat)
|
|
243
243
|
value = value.copy()
|
|
244
|
-
|
|
244
|
+
if stat == "potential_energy":
|
|
245
|
+
data[name] = -value
|
|
246
|
+
else:
|
|
247
|
+
data[name] = value
|
|
245
248
|
if stat == "num_steps":
|
|
246
249
|
data["tree_depth"] = np.log2(value).astype(int) + 1
|
|
247
250
|
return dict_to_dataset(
|
|
@@ -277,7 +277,7 @@ def _extract_arviz_dict_from_inference_data(
|
|
|
277
277
|
|
|
278
278
|
|
|
279
279
|
def _convert_arviz_dict_to_pyjags_dict(
|
|
280
|
-
samples: tp.Mapping[str, np.ndarray]
|
|
280
|
+
samples: tp.Mapping[str, np.ndarray],
|
|
281
281
|
) -> tp.Mapping[str, np.ndarray]:
|
|
282
282
|
"""
|
|
283
283
|
Convert and ArviZ dictionary to a PyJAGS dictionary.
|
|
@@ -251,7 +251,7 @@ def plot_bpv(
|
|
|
251
251
|
total_pp_samples = predictive_dataset.sizes["chain"] * predictive_dataset.sizes["draw"]
|
|
252
252
|
|
|
253
253
|
for key in coords.keys():
|
|
254
|
-
coords[key] = np.where(np.
|
|
254
|
+
coords[key] = np.where(np.isin(observed[key], coords[key]))[0]
|
|
255
255
|
|
|
256
256
|
obs_plotters = filter_plotters_list(
|
|
257
257
|
list(
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import numpy as np
|
|
4
4
|
|
|
5
|
+
|
|
5
6
|
from ..rcparams import rcParams
|
|
6
7
|
from .plot_utils import get_plotting_function
|
|
7
8
|
|
|
@@ -148,6 +149,7 @@ def plot_dot(
|
|
|
148
149
|
raise ValueError("marker argument is valid only for matplotlib backend")
|
|
149
150
|
|
|
150
151
|
values = np.ravel(values)
|
|
152
|
+
values = values[np.isfinite(values)]
|
|
151
153
|
values.sort()
|
|
152
154
|
|
|
153
155
|
if hdi_prob is None:
|
|
@@ -51,7 +51,7 @@ def plot_forest(
|
|
|
51
51
|
data : InferenceData
|
|
52
52
|
Any object that can be converted to an :class:`arviz.InferenceData` object
|
|
53
53
|
Refer to documentation of :func:`arviz.convert_to_dataset` for details.
|
|
54
|
-
kind : {"
|
|
54
|
+
kind : {"forestplot", "ridgeplot"}, default "forestplot"
|
|
55
55
|
Specify the kind of plot:
|
|
56
56
|
|
|
57
57
|
* The ``kind="forestplot"`` generates credible intervals, where the central points are the
|
|
@@ -75,8 +75,8 @@ def plot_forest(
|
|
|
75
75
|
interpret `var_names` as substrings of the real variables names. If "regex",
|
|
76
76
|
interpret `var_names` as regular expressions on the real variables names. See
|
|
77
77
|
:ref:`this section <common_filter_vars>` for usage examples.
|
|
78
|
-
transform : callable, optional
|
|
79
|
-
Function to transform data
|
|
78
|
+
transform : callable or dict, optional
|
|
79
|
+
Function to transform the data. Defaults to None, i.e., the identity function.
|
|
80
80
|
coords : dict, optional
|
|
81
81
|
Coordinates of ``var_names`` to be plotted. Passed to :meth:`xarray.Dataset.sel`.
|
|
82
82
|
See :ref:`this section <common_coords>` for usage examples.
|
|
@@ -228,7 +228,19 @@ def plot_forest(
|
|
|
228
228
|
|
|
229
229
|
datasets = [convert_to_dataset(datum) for datum in reversed(data)]
|
|
230
230
|
if transform is not None:
|
|
231
|
-
|
|
231
|
+
if callable(transform):
|
|
232
|
+
datasets = [transform(dataset) for dataset in datasets]
|
|
233
|
+
elif isinstance(transform, dict):
|
|
234
|
+
transformed_datasets = []
|
|
235
|
+
for dataset in datasets:
|
|
236
|
+
new_dataset = dataset.copy()
|
|
237
|
+
for var_name, func in transform.items():
|
|
238
|
+
if var_name in new_dataset:
|
|
239
|
+
new_dataset[var_name] = func(new_dataset[var_name])
|
|
240
|
+
transformed_datasets.append(new_dataset)
|
|
241
|
+
datasets = transformed_datasets
|
|
242
|
+
else:
|
|
243
|
+
raise ValueError("transform must be either a callable or a dict {var_name: callable}")
|
|
232
244
|
datasets = get_coords(
|
|
233
245
|
datasets, list(reversed(coords)) if isinstance(coords, (list, tuple)) else coords
|
|
234
246
|
)
|
|
@@ -304,7 +304,7 @@ def plot_ppc(
|
|
|
304
304
|
pp_sample_ix = np.random.choice(total_pp_samples, size=num_pp_samples, replace=False)
|
|
305
305
|
|
|
306
306
|
for key in coords.keys():
|
|
307
|
-
coords[key] = np.where(np.
|
|
307
|
+
coords[key] = np.where(np.isin(observed_data[key], coords[key]))[0]
|
|
308
308
|
|
|
309
309
|
obs_plotters = filter_plotters_list(
|
|
310
310
|
list(
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# pylint: disable=unused-import,unused-wildcard-import,wildcard-import,invalid-name
|
|
2
|
+
"""Expose features from arviz-xyz refactored packages inside ``arviz.preview`` namespace."""
|
|
3
|
+
import logging
|
|
4
|
+
|
|
5
|
+
_log = logging.getLogger(__name__)
|
|
6
|
+
|
|
7
|
+
info = ""
|
|
8
|
+
|
|
9
|
+
try:
|
|
10
|
+
from arviz_base import *
|
|
11
|
+
import arviz_base as base
|
|
12
|
+
|
|
13
|
+
_status = "arviz_base available, exposing its functions as part of arviz.preview"
|
|
14
|
+
_log.info(_status)
|
|
15
|
+
except ModuleNotFoundError:
|
|
16
|
+
_status = "arviz_base not installed"
|
|
17
|
+
_log.info(_status)
|
|
18
|
+
except ImportError:
|
|
19
|
+
_status = "Unable to import arviz_base"
|
|
20
|
+
_log.info(_status, exc_info=True)
|
|
21
|
+
|
|
22
|
+
info += _status + "\n"
|
|
23
|
+
|
|
24
|
+
try:
|
|
25
|
+
from arviz_stats import *
|
|
26
|
+
|
|
27
|
+
# the base computational module fron arviz_stats will override the alias to arviz-base
|
|
28
|
+
# arviz.stats.base will still be available
|
|
29
|
+
import arviz_base as base
|
|
30
|
+
import arviz_stats as stats
|
|
31
|
+
|
|
32
|
+
_status = "arviz_stats available, exposing its functions as part of arviz.preview"
|
|
33
|
+
_log.info(_status)
|
|
34
|
+
except ModuleNotFoundError:
|
|
35
|
+
_status = "arviz_stats not installed"
|
|
36
|
+
_log.info(_status)
|
|
37
|
+
except ImportError:
|
|
38
|
+
_status = "Unable to import arviz_stats"
|
|
39
|
+
_log.info(_status, exc_info=True)
|
|
40
|
+
info += _status + "\n"
|
|
41
|
+
|
|
42
|
+
try:
|
|
43
|
+
from arviz_plots import *
|
|
44
|
+
import arviz_plots as plots
|
|
45
|
+
|
|
46
|
+
_status = "arviz_plots available, exposing its functions as part of arviz.preview"
|
|
47
|
+
_log.info(_status)
|
|
48
|
+
except ModuleNotFoundError:
|
|
49
|
+
_status = "arviz_plots not installed"
|
|
50
|
+
_log.info(_status)
|
|
51
|
+
except ImportError:
|
|
52
|
+
_status = "Unable to import arviz_plots"
|
|
53
|
+
_log.info(_status, exc_info=True)
|
|
54
|
+
|
|
55
|
+
info += _status + "\n"
|
|
56
|
+
|
|
57
|
+
# clean namespace
|
|
58
|
+
del logging, _status, _log
|
|
@@ -12,11 +12,11 @@ from pathlib import Path
|
|
|
12
12
|
from typing import Any, Dict
|
|
13
13
|
from typing_extensions import Literal
|
|
14
14
|
|
|
15
|
-
NO_GET_ARGS: bool = False
|
|
15
|
+
NO_GET_ARGS: bool = False # pylint: disable=invalid-name
|
|
16
16
|
try:
|
|
17
17
|
from typing_extensions import get_args
|
|
18
18
|
except ImportError:
|
|
19
|
-
NO_GET_ARGS = True
|
|
19
|
+
NO_GET_ARGS = True # pylint: disable=invalid-name
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
import numpy as np
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
# pylint: disable=too-many-lines
|
|
2
2
|
"""Statistical functions in ArviZ."""
|
|
3
3
|
|
|
4
|
-
import itertools
|
|
5
4
|
import warnings
|
|
6
5
|
from copy import deepcopy
|
|
7
6
|
from typing import List, Optional, Tuple, Union, Mapping, cast, Callable
|
|
@@ -11,14 +10,14 @@ import pandas as pd
|
|
|
11
10
|
import scipy.stats as st
|
|
12
11
|
from xarray_einstats import stats
|
|
13
12
|
import xarray as xr
|
|
14
|
-
from scipy.optimize import minimize
|
|
13
|
+
from scipy.optimize import minimize, LinearConstraint, Bounds
|
|
15
14
|
from typing_extensions import Literal
|
|
16
15
|
|
|
17
|
-
NO_GET_ARGS: bool = False
|
|
16
|
+
NO_GET_ARGS: bool = False # pylint: disable=invalid-name
|
|
18
17
|
try:
|
|
19
18
|
from typing_extensions import get_args
|
|
20
19
|
except ImportError:
|
|
21
|
-
NO_GET_ARGS = True
|
|
20
|
+
NO_GET_ARGS = True # pylint: disable=invalid-name
|
|
22
21
|
|
|
23
22
|
from .. import _log
|
|
24
23
|
from ..data import InferenceData, convert_to_dataset, convert_to_inference_data, extract
|
|
@@ -225,37 +224,23 @@ def compare(
|
|
|
225
224
|
if method.lower() == "stacking":
|
|
226
225
|
rows, cols, ic_i_val = _ic_matrix(ics, ic_i)
|
|
227
226
|
exp_ic_i = np.exp(ic_i_val / scale_value)
|
|
228
|
-
km1 = cols - 1
|
|
229
|
-
|
|
230
|
-
def w_fuller(weights):
|
|
231
|
-
return np.concatenate((weights, [max(1.0 - np.sum(weights), 0.0)]))
|
|
232
227
|
|
|
233
228
|
def log_score(weights):
|
|
234
|
-
|
|
235
|
-
score = 0.0
|
|
236
|
-
for i in range(rows):
|
|
237
|
-
score += np.log(np.dot(exp_ic_i[i], w_full))
|
|
238
|
-
return -score
|
|
229
|
+
return -np.sum(np.log(exp_ic_i @ weights))
|
|
239
230
|
|
|
240
231
|
def gradient(weights):
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
theta = np.full(km1, 1.0 / cols)
|
|
248
|
-
bounds = [(0.0, 1.0) for _ in range(km1)]
|
|
249
|
-
constraints = [
|
|
250
|
-
{"type": "ineq", "fun": lambda x: -np.sum(x) + 1.0},
|
|
251
|
-
{"type": "ineq", "fun": np.sum},
|
|
252
|
-
]
|
|
232
|
+
denominator = exp_ic_i @ weights
|
|
233
|
+
return -np.sum(exp_ic_i / denominator[:, np.newaxis], axis=0)
|
|
234
|
+
|
|
235
|
+
theta = np.full(cols, 1.0 / cols)
|
|
236
|
+
bounds = Bounds(lb=np.zeros(cols), ub=np.ones(cols))
|
|
237
|
+
constraints = LinearConstraint(np.ones(cols), lb=1.0, ub=1.0)
|
|
253
238
|
|
|
254
|
-
|
|
239
|
+
minimize_result = minimize(
|
|
255
240
|
fun=log_score, x0=theta, jac=gradient, bounds=bounds, constraints=constraints
|
|
256
241
|
)
|
|
257
242
|
|
|
258
|
-
weights =
|
|
243
|
+
weights = minimize_result["x"]
|
|
259
244
|
ses = ics["se"]
|
|
260
245
|
|
|
261
246
|
elif method.lower() == "bb-pseudo-bma":
|
|
@@ -1510,6 +1510,15 @@ class TestDataTree:
|
|
|
1510
1510
|
assert_identical(ds, idata_back[group])
|
|
1511
1511
|
assert all(group in dt.children for group in idata.groups())
|
|
1512
1512
|
|
|
1513
|
+
def test_datatree_attrs(self):
|
|
1514
|
+
idata = load_arviz_data("centered_eight")
|
|
1515
|
+
idata.attrs = {"not": "empty"}
|
|
1516
|
+
assert idata.attrs
|
|
1517
|
+
dt = idata.to_datatree()
|
|
1518
|
+
idata_back = from_datatree(dt)
|
|
1519
|
+
assert dt.attrs == idata.attrs
|
|
1520
|
+
assert idata_back.attrs == idata.attrs
|
|
1521
|
+
|
|
1513
1522
|
|
|
1514
1523
|
class TestConversions:
|
|
1515
1524
|
def test_id_conversion_idempotent(self):
|
|
@@ -1652,3 +1661,19 @@ class TestExtractDataset:
|
|
|
1652
1661
|
post = extract(idata, num_samples=10)
|
|
1653
1662
|
assert post.sizes["sample"] == 10
|
|
1654
1663
|
assert post.attrs == idata.posterior.attrs
|
|
1664
|
+
|
|
1665
|
+
|
|
1666
|
+
def test_convert_to_inference_data_with_array_like():
|
|
1667
|
+
class ArrayLike:
|
|
1668
|
+
def __init__(self, data):
|
|
1669
|
+
self._data = np.asarray(data)
|
|
1670
|
+
|
|
1671
|
+
def __array__(self):
|
|
1672
|
+
return self._data
|
|
1673
|
+
|
|
1674
|
+
array_like = ArrayLike(np.random.randn(4, 100))
|
|
1675
|
+
idata = convert_to_inference_data(array_like, group="posterior")
|
|
1676
|
+
|
|
1677
|
+
assert hasattr(idata, "posterior")
|
|
1678
|
+
assert "x" in idata.posterior.data_vars
|
|
1679
|
+
assert idata.posterior["x"].shape == (4, 100)
|
|
@@ -2176,5 +2176,22 @@ def test_plot_autocorr_coords(coords, expected_vars):
|
|
|
2176
2176
|
idata = load_arviz_data("centered_eight")
|
|
2177
2177
|
|
|
2178
2178
|
axes = plot_autocorr(idata, var_names=expected_vars, coords=coords, show=False)
|
|
2179
|
+
assert axes is not None
|
|
2180
|
+
|
|
2181
|
+
|
|
2182
|
+
def test_plot_forest_with_transform():
|
|
2183
|
+
"""Test if plot_forest runs successfully with a transform dictionary."""
|
|
2184
|
+
data = xr.Dataset(
|
|
2185
|
+
{
|
|
2186
|
+
"var1": (["chain", "draw"], np.array([[1, 2, 3], [4, 5, 6]])),
|
|
2187
|
+
"var2": (["chain", "draw"], np.array([[7, 8, 9], [10, 11, 12]])),
|
|
2188
|
+
},
|
|
2189
|
+
coords={"chain": [0, 1], "draw": [0, 1, 2]},
|
|
2190
|
+
)
|
|
2191
|
+
transform_dict = {
|
|
2192
|
+
"var1": lambda x: x + 1,
|
|
2193
|
+
"var2": lambda x: x * 2,
|
|
2194
|
+
}
|
|
2179
2195
|
|
|
2196
|
+
axes = plot_forest(data, transform=transform_dict, show=False)
|
|
2180
2197
|
assert axes is not None
|
|
@@ -13,9 +13,9 @@ from ...stats.ecdf_utils import (
|
|
|
13
13
|
try:
|
|
14
14
|
import numba # pylint: disable=unused-import
|
|
15
15
|
|
|
16
|
-
numba_options = [True, False]
|
|
16
|
+
numba_options = [True, False] # pylint: disable=invalid-name
|
|
17
17
|
except ImportError:
|
|
18
|
-
numba_options = [False]
|
|
18
|
+
numba_options = [False] # pylint: disable=invalid-name
|
|
19
19
|
|
|
20
20
|
|
|
21
21
|
def test_compute_ecdf():
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# pylint: disable=no-member, invalid-name, redefined-outer-name
|
|
1
|
+
# pylint: disable=no-member, invalid-name, redefined-outer-name, too-many-public-methods
|
|
2
2
|
from collections import namedtuple
|
|
3
3
|
import numpy as np
|
|
4
4
|
import pytest
|
|
@@ -409,3 +409,26 @@ class TestDataNumPyro:
|
|
|
409
409
|
)
|
|
410
410
|
assert inference_data.predictions.obs.dims == ("chain", "draw", "J")
|
|
411
411
|
assert "J" in inference_data.predictions.obs.coords
|
|
412
|
+
|
|
413
|
+
def test_potential_energy_sign_conversion(self):
|
|
414
|
+
"""Test that potential energy is converted to log probability (lp) with correct sign."""
|
|
415
|
+
import numpyro
|
|
416
|
+
import numpyro.distributions as dist
|
|
417
|
+
from numpyro.infer import MCMC, NUTS
|
|
418
|
+
|
|
419
|
+
num_samples = 10
|
|
420
|
+
|
|
421
|
+
def simple_model():
|
|
422
|
+
numpyro.sample("x", dist.Normal(0, 1))
|
|
423
|
+
|
|
424
|
+
nuts_kernel = NUTS(simple_model)
|
|
425
|
+
mcmc = MCMC(nuts_kernel, num_samples=num_samples, num_warmup=5)
|
|
426
|
+
mcmc.run(PRNGKey(0), extra_fields=["potential_energy"])
|
|
427
|
+
|
|
428
|
+
# Get the raw extra fields from NumPyro
|
|
429
|
+
extra_fields = mcmc.get_extra_fields(group_by_chain=True)
|
|
430
|
+
# Convert to ArviZ InferenceData
|
|
431
|
+
inference_data = from_numpyro(mcmc)
|
|
432
|
+
arviz_lp = inference_data["sample_stats"]["lp"].values
|
|
433
|
+
|
|
434
|
+
np.testing.assert_array_equal(arviz_lp, -extra_fields["potential_energy"])
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: arviz
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.23.0
|
|
4
4
|
Summary: Exploratory analysis of Bayesian models
|
|
5
5
|
Home-page: http://github.com/arviz-devs/arviz
|
|
6
6
|
Author: ArviZ Developers
|
|
@@ -20,9 +20,42 @@ Classifier: Topic :: Scientific/Engineering :: Visualization
|
|
|
20
20
|
Classifier: Topic :: Scientific/Engineering :: Mathematics
|
|
21
21
|
Requires-Python: >=3.10
|
|
22
22
|
Description-Content-Type: text/markdown
|
|
23
|
+
License-File: LICENSE
|
|
24
|
+
Requires-Dist: setuptools>=60.0.0
|
|
25
|
+
Requires-Dist: matplotlib>=3.8
|
|
26
|
+
Requires-Dist: numpy>=1.26.0
|
|
27
|
+
Requires-Dist: scipy>=1.11.0
|
|
28
|
+
Requires-Dist: packaging
|
|
29
|
+
Requires-Dist: pandas>=2.1.0
|
|
30
|
+
Requires-Dist: xarray>=2023.7.0
|
|
31
|
+
Requires-Dist: h5netcdf>=1.0.2
|
|
32
|
+
Requires-Dist: typing_extensions>=4.1.0
|
|
33
|
+
Requires-Dist: xarray-einstats>=0.3
|
|
23
34
|
Provides-Extra: all
|
|
35
|
+
Requires-Dist: numba; extra == "all"
|
|
36
|
+
Requires-Dist: netcdf4; extra == "all"
|
|
37
|
+
Requires-Dist: bokeh>=3; extra == "all"
|
|
38
|
+
Requires-Dist: contourpy; extra == "all"
|
|
39
|
+
Requires-Dist: ujson; extra == "all"
|
|
40
|
+
Requires-Dist: dask[distributed]; extra == "all"
|
|
41
|
+
Requires-Dist: zarr<3,>=2.5.0; extra == "all"
|
|
42
|
+
Requires-Dist: xarray>=2024.11.0; extra == "all"
|
|
43
|
+
Requires-Dist: dm-tree>=0.1.8; extra == "all"
|
|
24
44
|
Provides-Extra: preview
|
|
25
|
-
|
|
45
|
+
Requires-Dist: arviz-base[h5netcdf]; extra == "preview"
|
|
46
|
+
Requires-Dist: arviz-stats[xarray]; extra == "preview"
|
|
47
|
+
Requires-Dist: arviz-plots; extra == "preview"
|
|
48
|
+
Dynamic: author
|
|
49
|
+
Dynamic: classifier
|
|
50
|
+
Dynamic: description
|
|
51
|
+
Dynamic: description-content-type
|
|
52
|
+
Dynamic: home-page
|
|
53
|
+
Dynamic: license
|
|
54
|
+
Dynamic: license-file
|
|
55
|
+
Dynamic: provides-extra
|
|
56
|
+
Dynamic: requires-dist
|
|
57
|
+
Dynamic: requires-python
|
|
58
|
+
Dynamic: summary
|
|
26
59
|
|
|
27
60
|
<img src="https://raw.githubusercontent.com/arviz-devs/arviz-project/main/arviz_logos/ArviZ.png#gh-light-mode-only" width=200></img>
|
|
28
61
|
<img src="https://raw.githubusercontent.com/arviz-devs/arviz-project/main/arviz_logos/ArviZ_white.png#gh-dark-mode-only" width=200></img>
|
arviz-0.22.0/arviz/preview.py
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
# pylint: disable=unused-import,unused-wildcard-import,wildcard-import,invalid-name
|
|
2
|
-
"""Expose features from arviz-xyz refactored packages inside ``arviz.preview`` namespace."""
|
|
3
|
-
import logging
|
|
4
|
-
|
|
5
|
-
_log = logging.getLogger(__name__)
|
|
6
|
-
|
|
7
|
-
info = ""
|
|
8
|
-
|
|
9
|
-
try:
|
|
10
|
-
from arviz_base import *
|
|
11
|
-
|
|
12
|
-
status = "arviz_base available, exposing its functions as part of arviz.preview"
|
|
13
|
-
_log.info(status)
|
|
14
|
-
except ModuleNotFoundError:
|
|
15
|
-
status = "arviz_base not installed"
|
|
16
|
-
_log.info(status)
|
|
17
|
-
except ImportError:
|
|
18
|
-
status = "Unable to import arviz_base"
|
|
19
|
-
_log.info(status, exc_info=True)
|
|
20
|
-
|
|
21
|
-
info += status + "\n"
|
|
22
|
-
|
|
23
|
-
try:
|
|
24
|
-
from arviz_stats import *
|
|
25
|
-
|
|
26
|
-
status = "arviz_stats available, exposing its functions as part of arviz.preview"
|
|
27
|
-
_log.info(status)
|
|
28
|
-
except ModuleNotFoundError:
|
|
29
|
-
status = "arviz_stats not installed"
|
|
30
|
-
_log.info(status)
|
|
31
|
-
except ImportError:
|
|
32
|
-
status = "Unable to import arviz_stats"
|
|
33
|
-
_log.info(status, exc_info=True)
|
|
34
|
-
info += status + "\n"
|
|
35
|
-
|
|
36
|
-
try:
|
|
37
|
-
from arviz_plots import *
|
|
38
|
-
|
|
39
|
-
status = "arviz_plots available, exposing its functions as part of arviz.preview"
|
|
40
|
-
_log.info(status)
|
|
41
|
-
except ModuleNotFoundError:
|
|
42
|
-
status = "arviz_plots not installed"
|
|
43
|
-
_log.info(status)
|
|
44
|
-
except ImportError:
|
|
45
|
-
status = "Unable to import arviz_plots"
|
|
46
|
-
_log.info(status, exc_info=True)
|
|
47
|
-
|
|
48
|
-
info += status + "\n"
|