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

Dynamically generate lists in documentation #221

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

brandonwillard
Copy link
Member

@brandonwillard brandonwillard commented Jan 7, 2023

This PR adds a custom SphinxDirective that dynamically generates cross-reference links to RandomVariables in Aesara that are supported by logprob (i.e. that have a registered dispatch). See here for the results.

  • Dynamically generate the Ops and RVTransforms in the "Invertible Transforms" section

@rlouf
Copy link
Member

rlouf commented Jan 7, 2023

What do the TransformedX distributions with X being a distribution registered with _logprob correspond to? In this case I think we should exclude them.

For distributions we also need a way to specify usage: the links refer to the Op documentation, but the way to instantiate these Ops (e.g. at.random.normal) is nowhere specified. Should we add code examples in the Op's docstrings directly?

We will also find a way to document the use with RandomStream, and only this one here.

@brandonwillard
Copy link
Member Author

What do the TransformedX distributions with X being a distribution registered with _logprob correspond to? In this case I think we should exclude them.

Yes, we definitely need to exclude those. They come from all the module-level create_default_transformed_rv_op calls in aeppl.transforms, I believe.

@brandonwillard
Copy link
Member Author

For distributions we also need a way to specify usage: the links refer to the Op documentation, but the way to instantiate these Ops (e.g. at.random.normal) is nowhere specified. Should we had code examples in the Op's docstrings directly?

We could also show a single example that explains most/all other cases; otherwise, we could attempt to generate RST for complete examples, but that seems like a lot.

@rlouf
Copy link
Member

rlouf commented Jan 15, 2023

We could also show a single example that explains most/all other cases; otherwise, we could attempt to generate RST for complete examples, but that seems like a lot.

It is a lot, but it doesn't need to be done right now.

@rlouf
Copy link
Member

rlouf commented Jan 24, 2023

I added a commit that excludes the RandomVariables created with create_default_transformed_rv_op.

@rlouf
Copy link
Member

rlouf commented Jan 25, 2023

I have added a directive to list the invertible transforms, but it would be nice to have it displayed as autoclass does. The Sphinx API really is not making things easy and I'm wondering if our time would be better spent setting something like AutoAPI up.

@brandonwillard
Copy link
Member Author

I have added a directive to list the invertible transforms, but it would be nice to have it displayed as autoclass does. The Sphinx API really is not making things easy and I'm wondering if our time would be better spent setting something like AutoAPI up.

Those additions looks greatm thanks!

Yeah, I think AutoAPI might help, but I'll have to take another look at the details, because I don't remember much about them.

@brandonwillard brandonwillard marked this pull request as ready for review February 15, 2023 18:04
@brandonwillard brandonwillard added the enhancement New feature or request label Feb 15, 2023
@rlouf
Copy link
Member

rlouf commented Feb 15, 2023

I'm still hoping to get the transformations nicely documented here. For instance generating something like the following directive:

.. autosummary::
   :toctree: _generated

   transform_1_name
   transform_2_name

@rlouf rlouf force-pushed the dynamically-generate-logprob-rvs branch 4 times, most recently from 7c49e9d to 1a1d422 Compare February 22, 2023 16:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants