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

Add always-visible titles to the example gallery. #1484

Merged
merged 12 commits into from
Jan 16, 2021

Conversation

rpgoldman
Copy link
Contributor

Previously the only titles were in tooltips, which made it near impossible to scan the page and find the example you wanted.

Note that this is a WIP if only because there's an Easter Egg in one of the titles that needs fixing!

@rpgoldman rpgoldman added the User Documentation Documentation outside of the codebase label Jan 3, 2021
Copy link
Member

@ColCarroll ColCarroll left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found the easter egg!

Is there a reason to not just use ex_title as the title? We could even start throwing exceptions or something if it wasn't found. I don't feel strongly either way.

doc/sphinxext/gallery_generator.py Outdated Show resolved Hide resolved
doc/sphinxext/gallery_generator.py Show resolved Hide resolved
doc/sphinxext/gallery_generator.py Outdated Show resolved Hide resolved
examples/matplotlib/mpl_plot_ess_evolution.py Outdated Show resolved Hide resolved
@@ -3,6 +3,7 @@
====================

_thumb: .5, .7
_example_title: Plot LOO overlayed on <i>some damn thing</i>.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

watch your language!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was hoping you knew what it was overlayed on...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

...and whether it's "overlayed" or "overlaid"!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

overlaid i believe

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would write something like Plot LOO-PIT KDE overlaid on uniform distributions KDEs, but I find it quite hard to summarize that more that what is said in the Examples section of its API docs without loosing so much meaning it can only be understood if you already know what it means

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we assume someone using this would know what are CDF and inverse-CDF? Maybe Wikipedia's PIT article helps https://en.wikipedia.org/wiki/Probability_integral_transform ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@avehtari Probably we can make that assumption, in which case we can give this a title that explains it sufficiently for such a person.

Plot LOO overlaid on uniform distributions to assess convergence.

Would that be good?

This does beg the question -- if a person does not know the purpose of this plot, where should they look? API docs? Examples? Or do we need a tutorial of some form?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would say that ideally they would look at the API docs (each example already has a link to the relevant function) if necessary they can go to other resources from there, reference papers, it's page in the educational materials repo (which does not exist yet) and other relevant links that may be present.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I put in the above suggested title -- "Plot LOO overlaid on uniform distributions to assess convergence." Marking this as resolved.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. It's missing a word: Plot LOO "what" overlaid on...
    LOO can mean many things, and the confusion could that some would think it's LOO elpds. If you think that probability integral transformation is not well known, how about "LOO predictive ECDF" ?
  2. It's not about convergence, but about model checking. So the full sentence could be
    "Plot LOO predictive ECDF overlaid on ECDFs of uniform samples to assess predictive calibration"

@rpgoldman
Copy link
Contributor Author

I found the easter egg!

Is there a reason to not just use ex_title as the title? We could even start throwing exceptions or something if it wasn't found. I don't feel strongly either way.

I put changes in ex_title for a couple of reasons:

  1. It lets us put something different on the thumbnail for people who are searching for a particular plot.
  2. It also lets us have longer titles, if we want, that wouldn't fit on the examples page.

@codecov
Copy link

codecov bot commented Jan 3, 2021

Codecov Report

Merging #1484 (7dec9fd) into master (ae8a613) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1484   +/-   ##
=======================================
  Coverage   91.92%   91.92%           
=======================================
  Files         105      105           
  Lines       11252    11252           
=======================================
  Hits        10343    10343           
  Misses        909      909           
Impacted Files Coverage Δ
arviz/plots/khatplot.py 94.87% <ø> (ø)
arviz/plots/separationplot.py 73.68% <ø> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ae8a613...7dec9fd. Read the comment docs.

@rpgoldman
Copy link
Contributor Author

One thing that would be nice to fix before merging: separation plot.

  1. the only description of the separation plot cited is from an article hidden behind a paywall.
  2. the thumbnail is just a wall of blue.

@rpgoldman
Copy link
Contributor Author

I just pushed a new version with a better-centered matplotlib separation plot.

@rpgoldman
Copy link
Contributor Author

Calling this good enough and clearing the WIP flag.

@rpgoldman rpgoldman marked this pull request as ready for review January 12, 2021 02:19
Copy link
Contributor Author

@rpgoldman rpgoldman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only one I'm not sure about is the change to mpl_plot_ess_local -- the reason I added the phrase that you took out was that the term "local" was not clear. What makes an expected sample size local?

Copy link
Contributor Author

@rpgoldman rpgoldman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other than that one point, these all seem like clear improvements.

@rpgoldman
Copy link
Contributor Author

These test failures aren't due to this MR.

@rpgoldman
Copy link
Contributor Author

Last thing, if we have the energy, would be to apply these changes to the Bokeh figures, as well.

@OriolAbril
Copy link
Member

What makes an expected sample size local?

The quantile ess is calculated with P(theta < theta_quantile) (see equation 16 in the reference) whereas the local ess is calculated with P(theta_quantile < theta < theta_quantile+delta) (eq 19). From the paper:

(...) This gives us a local efficiency measure which is more localized than efficiency measure for quantiles and can be used to build intuition about what types of posterior functionals can be computed as illustrated in the examples. While the expectation of a function that only depends on intermediate values can be usually estimated with relative ease, expectations of tail probabilities or other posterior functionals that depend critically on the tail of the distribution will be usually more difficult to estimate. In addition, small probability intervals can be used in practical equivalence testing

reference: https://arxiv.org/pdf/1903.08008.pdf

if we have the energy, would be to apply these changes to the Bokeh figures

I would wait for that, I want to try simplifying the example gallery using tabs like https://sphinx-panels.readthedocs.io/en/latest/#tabbed-content. After all, the title is the same, the api reference is the same, and it would allow having a single thumbnail and avoid generating bokeh thumbnails which is the main complication when generating the docs and requires weird dependencies.

@rpgoldman
Copy link
Contributor Author

In that case, I think we are ready to merge.

rpgoldman and others added 11 commits January 16, 2021 03:07
Previously, it was hard to find things in the gallery generator, because the only information was in tooltips that were hidden by default.
Extend the docstring based on explanation from Aki Vehtari
Improve the reference to make it easier for readers to find.
Embedded Latex causes complaints about anomalous strings from pydocstyle and pylint.
@OriolAbril OriolAbril merged commit e9d2f2b into arviz-devs:master Jan 16, 2021
@OriolAbril OriolAbril mentioned this pull request Jan 23, 2021
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
User Documentation Documentation outside of the codebase
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants