arviz-devs / arviz-plots

ArviZ modular plotting
https://arviz-plots.readthedocs.io
Apache License 2.0
2 stars 1 forks source link

Adding Plot ESS Evolution #71

Open imperorrp opened 1 month ago

imperorrp commented 1 month ago

First commit for plot_ess_evolution(), as a branched off plot from legacy plot_ess for kind = 'evolution' (https://github.com/arviz-devs/arviz-plots/issues/5). The line_xy and scatter_xy visual elements were used for the plotting, with rug plot, axes labelling and title labelling functionality taken from ESS plot functionality. Since the ESS plot PR hasn't been merged yet, the scatter_xy visual element was duplicated for use here.

WIP:

Marking the 'bulk' and 'tail' artists with a legend

Current plot outputs:

azp.plot_ess_evolution(data) image

azp.plot_ess_evolution(data, var_names=["mu", "tau"]) image


📚 Documentation preview 📚: https://arviz-plots--71.org.readthedocs.build/en/71/

codecov-commenter commented 1 month ago

Codecov Report

Attention: Patch coverage is 94.05405% with 11 lines in your changes missing coverage. Please review.

Project coverage is 84.67%. Comparing base (a1e32a5) to head (620ae63).

Files Patch % Lines
src/arviz_plots/plots/evolutionplot.py 94.15% 10 Missing :warning:
src/arviz_plots/visuals/__init__.py 91.66% 1 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #71 +/- ## ========================================== + Coverage 83.83% 84.67% +0.84% ========================================== Files 20 21 +1 Lines 2270 2454 +184 ========================================== + Hits 1903 2078 +175 - Misses 367 376 +9 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

imperorrp commented 1 month ago

Updated plot_ess_evolution. The points and lines for both 'bulk' and 'tail' methods can now be turned on and off via plot_kwargs, the mean, sd, and min_ess were added following the current plot_ess logic, and xlabel and ylabel texts can also now be set separately.

Also added a common ess_dataset computing function since it can be called upto 4 times (one for each of the cartesian product of 'bulk', 'tail' and points, lines).

The rug plot element is still WIP.

The outputs without the rug are now like: image

image

image

An aesthetics issue with the color coding of the mean/sd plot elements:

For the mean/sd plotting (and this'd similarly apply to plot_ess too) it looks like setting mean and sd to one color by default as I'm doing currently makes it hard to interpret that they have been overlapped when they coincide: image

When they're not set to the same color, it's visible that they coincide and are overlapped but then the colors might be confusing as they correspond to the 'bulk' and 'tail' plotting elements' colors too: image

imperorrp commented 3 weeks ago

Rebased plot ess evolution commits

imperorrp commented 3 weeks ago

The mean and sd lines are now annotated:

image

Should the min_ess line also be annotated? (This also applies for ESS plot #58 ). Current Arviz ESS plot doesn't have it annotated (https://github.com/arviz-devs/arviz/blob/main/arviz/plots/backends/matplotlib/essplot.py#L150) but it would probably be nice to have and is easy to add.

imperorrp commented 1 week ago

Fixed hypothesis tests errors and documentation build