Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor plot_ecdf arguments #2316

Merged
merged 48 commits into from
Jun 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
d93f1fa
Add rcparam for band probability
sethaxen Feb 22, 2024
f2ccb30
Unify plot_ecdf keywords and deprecate old ones
sethaxen Feb 22, 2024
5369471
Change default num_trials to match plot_ecdf
sethaxen Feb 22, 2024
5e63b72
Support keywords rvs and random_state
sethaxen Feb 22, 2024
3026bd9
Deprecate values2
sethaxen Feb 22, 2024
1ca6892
Allow eval_points to be specified
sethaxen Feb 23, 2024
fddd415
Restore original name confidence_bands
sethaxen Feb 23, 2024
a99d6a2
Correctly specify ecdf usage
sethaxen Feb 23, 2024
4f2dab9
Include recommended specification of eval_points
sethaxen Feb 23, 2024
495e29f
Update examples in docstrings
sethaxen Feb 23, 2024
7679805
Deprecate pit keyword
sethaxen Feb 23, 2024
6602775
Ravel values2
sethaxen Feb 23, 2024
43fce45
Change band_prob default to 0.95
sethaxen Feb 23, 2024
2ae21d7
Run black
sethaxen Feb 23, 2024
4a75171
Add band_prob to to rctemplate
sethaxen Feb 23, 2024
ff4d2c3
Use deprecation warnings
sethaxen Feb 23, 2024
24c8347
Test deprecations
sethaxen Feb 23, 2024
fd1edd7
test eval_points accepted
sethaxen Feb 23, 2024
059e281
Check confidence_bands args
sethaxen Feb 23, 2024
f1b1076
Test ecdfplot errors
sethaxen Feb 23, 2024
a7dedfe
Update CHANGELOG.md
sethaxen Feb 23, 2024
29380ab
Update CHANGELOG.md
sethaxen Feb 23, 2024
b6948fc
Move scipy.stats.ecdf import to top of file
sethaxen Feb 23, 2024
9ebfcd0
Remove duplicate warnings import
sethaxen Feb 23, 2024
44d971b
Fix linting errors
sethaxen Feb 23, 2024
f2d9fa2
Add missing newline
sethaxen Feb 23, 2024
4e4be74
Mark valus2 as deprecated
sethaxen Mar 31, 2024
13e0863
Fix bulleted list of confidence_bands options
sethaxen Mar 31, 2024
194d3b9
Clean up acceptable types for `random_state`
sethaxen Mar 31, 2024
750e2b5
Use deprecated directive for other keywords
sethaxen Mar 31, 2024
13b09fe
Make deprecation note more specific
sethaxen Mar 31, 2024
7659fb9
Deprecate `npoints`
sethaxen Mar 31, 2024
c38e45e
Move deprecated keywords to end of keywords list
sethaxen Mar 31, 2024
b9190f1
Update CHANGELOG.md
sethaxen Mar 31, 2024
c6131ff
Add missing newline
sethaxen Apr 3, 2024
effd669
Rename band_prob to ci_prob
sethaxen Apr 3, 2024
3a75252
Change ci_prob default to 0.94
sethaxen Apr 3, 2024
8b869bc
Deprecate hdi_prob and replace with stats.ci_prob
sethaxen Apr 3, 2024
bd472e7
Support rvs with no keywords
sethaxen Apr 3, 2024
6fba0a8
Unify docstrings
sethaxen Apr 3, 2024
257e0c0
Change deprecation warning to future warning
sethaxen Apr 4, 2024
766971f
Test deprecated rcparams
sethaxen Apr 4, 2024
ef7a734
Use stats.ci_prob in plots
sethaxen Apr 4, 2024
6985873
Use stats.ci_prob in docs
sethaxen Apr 4, 2024
1669d66
Don't access protected class variable
sethaxen Apr 4, 2024
7f25a2c
Apply suggestions from code review
OriolAbril Apr 4, 2024
6557824
use BehaviourChangeWarning
OriolAbril Jun 10, 2024
f414ab0
black and docstring updates
OriolAbril Jun 11, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
### New features
- Use revised Pareto k threshold ([2349](https://github.com/arviz-devs/arviz/pull/2349))

- Added arguments `ci_prob`, `eval_points`, `rvs`, and `random_state` to `plot_ecdf` ([2316](https://github.com/arviz-devs/arviz/pull/2316))
- Deprecated rcParam `stats.hdi_prob` and replaced with `stats.ci_prob` ([2316](https://github.com/arviz-devs/arviz/pull/2316))

### Maintenance and fixes
- Ensure support with numpy 2.0 ([2321](https://github.com/arviz-devs/arviz/pull/2321))
- Update testing strategy to include an environment without optional dependencies and
Expand All @@ -16,6 +19,8 @@
- Support for arrays and DataArrays in plot_khat has been deprecated. Only ELPDdata will be supported in the future ([2349](https://github.com/arviz-devs/arviz/pull/2349))


- Removed arguments `values2`, `fpr`, `pointwise`, and `pit` in `plot_ecdf` ([2316](https://github.com/arviz-devs/arviz/pull/2316))

### Documentation

## v0.18.0 (2024 Apr 4)
Expand All @@ -30,6 +35,12 @@
- Fix deprecation warnings in multiple dependencies ([2329](https://github.com/arviz-devs/arviz/pull/2329),
[2332](https://github.com/arviz-devs/arviz/pull/2332) and [2333](https://github.com/arviz-devs/arviz/pull/2333))

### Deprecation

- Removed arguments `values2`, `fpr`, `pointwise`, `npoints`, and `pit` in `plot_ecdf` ([2316](https://github.com/arviz-devs/arviz/pull/2316))

### Documentation

## v0.17.1 (2024 Mar 13)

### Maintenance and fixes
Expand Down
3 changes: 1 addition & 2 deletions arviz/plots/backends/bokeh/ecdfplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ def plot_ecdf(
x_bands,
lower,
higher,
confidence_bands,
plot_kwargs,
fill_kwargs,
plot_outline_kwargs,
Expand Down Expand Up @@ -58,7 +57,7 @@ def plot_ecdf(
plot_outline_kwargs.setdefault("color", to_hex("C0"))
plot_outline_kwargs.setdefault("alpha", 0.2)

if confidence_bands:
if x_bands is not None:
ax.step(x_coord, y_coord, **plot_kwargs)

if fill_band:
Expand Down
3 changes: 1 addition & 2 deletions arviz/plots/backends/matplotlib/ecdfplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ def plot_ecdf(
x_bands,
lower,
higher,
confidence_bands,
plot_kwargs,
fill_kwargs,
plot_outline_kwargs,
Expand Down Expand Up @@ -59,7 +58,7 @@ def plot_ecdf(

ax.step(x_coord, y_coord, **plot_kwargs)

if confidence_bands:
if x_bands is not None:
if fill_band:
ax.fill_between(x_bands, lower, higher, **fill_kwargs)
else:
Expand Down
4 changes: 2 additions & 2 deletions arviz/plots/bpvplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
hdi_prob : float, optional
Probability for the highest density interval for the analytical reference distribution when
``kind=u_values``. Should be in the interval (0, 1]. Defaults to the
rcParam ``stats.hdi_prob``. See :ref:`this section <common_hdi_prob>` for usage examples.
rcParam ``stats.ci_prob``. See :ref:`this section <common_hdi_prob>` for usage examples.
color : str, optional
Matplotlib color
grid : tuple, optional
Expand Down Expand Up @@ -202,7 +202,7 @@
raise TypeError("`reference` argument must be either `analytical`, `samples`, or `None`")

if hdi_prob is None:
hdi_prob = rcParams["stats.hdi_prob"]
hdi_prob = rcParams["stats.ci_prob"]

Check warning on line 205 in arviz/plots/bpvplot.py

View check run for this annotation

Codecov / codecov/patch

arviz/plots/bpvplot.py#L205

Added line #L205 was not covered by tests
elif not 1 >= hdi_prob > 0:
raise ValueError("The value of hdi_prob should be in the interval (0, 1]")

Expand Down
2 changes: 1 addition & 1 deletion arviz/plots/densityplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ def plot_density(
)

if hdi_prob is None:
hdi_prob = rcParams["stats.hdi_prob"]
hdi_prob = rcParams["stats.ci_prob"]
elif not 1 >= hdi_prob > 0:
raise ValueError("The value of hdi_prob should be in the interval (0, 1]")

Expand Down
4 changes: 2 additions & 2 deletions arviz/plots/dotplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def plot_dot(
The shape of the marker. Valid for matplotlib backend.
hdi_prob : float, optional
Valid only when point_interval is True. Plots HDI for chosen percentage of density.
Defaults to ``stats.hdi_prob`` rcParam. See :ref:`this section <common_hdi_prob>`
Defaults to ``stats.ci_prob`` rcParam. See :ref:`this section <common_hdi_prob>`
for usage examples.
rotated : bool, default False
Whether to rotate the dot plot by 90 degrees.
Expand Down Expand Up @@ -151,7 +151,7 @@ def plot_dot(
values.sort()

if hdi_prob is None:
hdi_prob = rcParams["stats.hdi_prob"]
hdi_prob = rcParams["stats.ci_prob"]
elif not 1 >= hdi_prob > 0:
raise ValueError("The value of hdi_prob should be in the interval (0, 1]")

Expand Down
Loading