aesara-devs / aeppl

Tools for an Aesara-based PPL.
https://aeppl.readthedocs.io
MIT License
64 stars 20 forks source link

Dynamically generate lists in documentation #221

Open brandonwillard opened 1 year ago

brandonwillard commented 1 year ago

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.

rlouf commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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

rlouf commented 1 year ago

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 commented 1 year ago

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.

rlouf commented 1 year ago

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