Skip to content

Commit 3713edf

Browse files
authored
Prepare release 0.17.0 (#2300)
* rerun quickstart and working with inferencedata nbs * doc fixes add dataarray and dataset as type aliases fix css for homepage * add encoding arg for reading html_repr's css * improve psislw docstring * add docstring to smooth_data * remove show=True in tests * update changelog and bump version * make smooth data public api * extend numpydoc type ignores
1 parent 27b8a49 commit 3713edf

File tree

16 files changed

+9194
-5544
lines changed

16 files changed

+9194
-5544
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,9 @@ doc/source/user_guide/wrappers/*
8282
!doc/source/user_guide/wrappers/*.md
8383

8484
# eight-schools files
85+
doc/source/getting_started/schools*
86+
!doc/source/user_guide/wrappers/schools.stan
87+
!doc/source/user_guide/wrappers/schools.json
8588
doc/source/getting_started/eight_school*
8689
doc/source/getting_started/sample_data/
8790

CHANGELOG.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,23 @@
11
# Change Log
22

3-
## v0.x.x Unreleased
3+
## v0.17.0 (2023 Dec 22)
44

55
### New features
66
- Add prior sensitivity diagnostic `psens` ([2093](https://github.com/arviz-devs/arviz/pull/2093))
7-
- Add filter_vars functionality to `InfereceData.to_dataframe`method ([2277](https://github.com/arviz-devs/arviz/pull/2277))
7+
- Add filter_vars functionality to `InfereceData.to_dataframe`method ([2277](https://github.com/arviz-devs/arviz/pull/2277))
88

99
### Maintenance and fixes
1010

1111
- Update requirements: matplotlib>=3.5, pandas>=1.4.0, numpy>=1.22.0 ([2280](https://github.com/arviz-devs/arviz/pull/2280))
1212
- Fix behaviour of `plot_ppc` when dimension order isn't `chain, draw, ...` ([2283](https://github.com/arviz-devs/arviz/pull/2283))
1313
- Avoid repeating the variable name in `plot_ppc`, `plot_bpv`, `plot_loo_pit`... when repeated. ([2283](https://github.com/arviz-devs/arviz/pull/2283))
1414
- Add support for the latest CmdStanPy. ([2287](https://github.com/arviz-devs/arviz/pull/2287))
15-
16-
### Deprecation
15+
- Fix import error on windows due to missing encoding argument ([2300](https://github.com/arviz-devs/arviz/pull/2300))
16+
- Add ``__delitem__`` method to InferenceData ([2292](https://github.com/arviz-devs/arviz/pull/2292))
1717

1818
### Documentation
19+
- Improve the docstring of `psislw` ([2300](https://github.com/arviz-devs/arviz/pull/2300))
20+
- Rerun the quickstart and working with InferenceData notebooks ([2300](https://github.com/arviz-devs/arviz/pull/2300))
1921

2022
- Several fixes in `plot_ppc` docstring ([2283](https://github.com/arviz-devs/arviz/pull/2283))
2123

arviz/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# pylint: disable=wildcard-import,invalid-name,wrong-import-position
22
"""ArviZ is a library for exploratory analysis of Bayesian models."""
3-
__version__ = "0.17.0.dev0"
3+
__version__ = "0.17.0"
44

55
import logging
66
import os

arviz/plots/bpvplot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ def plot_bpv(
165165
Notes
166166
-----
167167
Discrete data is smoothed before computing either p-values or u-values using the
168-
function :func:`smooth_data`
168+
function :func:`~arviz.smooth_data`
169169
170170
Examples
171171
--------

arviz/stats/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
"autocorr",
2929
"autocov",
3030
"make_ufunc",
31+
"smooth_data",
3132
"wrap_xarray_ufunc",
3233
"reloo",
3334
"_calculate_ics",

arviz/stats/stats.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -880,17 +880,18 @@ def psislw(log_weights, reff=1.0):
880880
881881
Parameters
882882
----------
883-
log_weights: array
883+
log_weights : DataArray or (..., N) array-like
884884
Array of size (n_observations, n_samples)
885-
reff: float
885+
reff : float, default 1
886886
relative MCMC efficiency, ``ess / n``
887887
888888
Returns
889889
-------
890-
lw_out: array
891-
Smoothed log weights
892-
kss: array
893-
Pareto tail indices
890+
lw_out : DataArray or (..., N) ndarray
891+
Smoothed, truncated and normalized log weights.
892+
kss : DataArray or (...) ndarray
893+
Estimates of the shape parameter *k* of the generalized Pareto
894+
distribution.
894895
895896
References
896897
----------

arviz/stats/stats_utils.py

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
from .density_utils import histogram as _histogram
1717

1818

19-
__all__ = ["autocorr", "autocov", "ELPDData", "make_ufunc", "wrap_xarray_ufunc"]
19+
__all__ = ["autocorr", "autocov", "ELPDData", "make_ufunc", "smooth_data", "wrap_xarray_ufunc"]
2020

2121

2222
def autocov(ary, axis=-1):
@@ -564,7 +564,25 @@ def _circular_standard_deviation(samples, high=2 * np.pi, low=0, skipna=False, a
564564

565565

566566
def smooth_data(obs_vals, pp_vals):
567-
"""Smooth data, helper function for discrete data in plot_pbv, loo_pit and plot_loo_pit."""
567+
"""Smooth data using a cubic spline.
568+
569+
Helper function for discrete data in plot_pbv, loo_pit and plot_loo_pit.
570+
571+
Parameters
572+
----------
573+
obs_vals : (N) array-like
574+
Observed data
575+
pp_vals : (S, N) array-like
576+
Posterior predictive samples. ``N`` is the number of observations,
577+
and ``S`` is the number of samples (generally n_chains*n_draws).
578+
579+
Returns
580+
-------
581+
obs_vals : (N) ndarray
582+
Smoothed observed data
583+
pp_vals : (S, N) ndarray
584+
Smoothed posterior predictive samples
585+
"""
568586
x = np.linspace(0, 1, len(obs_vals))
569587
csi = CubicSpline(x, obs_vals)
570588
obs_vals = csi(np.linspace(0.01, 0.99, len(obs_vals)))

arviz/tests/base_tests/test_plots_matplotlib.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1921,7 +1921,7 @@ def test_plot_ts(kwargs):
19211921
dims={"y": ["obs_dim"], "z": ["pred_dim"]},
19221922
)
19231923

1924-
ax = plot_ts(idata=idata, y="y", show=True, **kwargs)
1924+
ax = plot_ts(idata=idata, y="y", **kwargs)
19251925
assert np.all(ax)
19261926

19271927

arviz/utils.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -668,7 +668,8 @@ def _load_static_files():
668668
Clone from xarray.core.formatted_html_template.
669669
"""
670670
return [
671-
importlib.resources.files("arviz").joinpath(fname).read_text() for fname in STATIC_FILES
671+
importlib.resources.files("arviz").joinpath(fname).read_text(encoding="utf-8")
672+
for fname in STATIC_FILES
672673
]
673674

674675

doc/source/_static/custom.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ html[data-theme="dark"] {
8080
}
8181
.primary-button {
8282
background-color: var(--pst-color-primary);
83-
color: var(--pst-color-background);
83+
color: var(--pst-color-background) !important;
8484
}
8585
.secondary-button {
8686
background-color: var(--pst-color-background);

0 commit comments

Comments
 (0)