Refactoring printing module with aeppl/printing.py #6447
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #6311 and #6261, supersedes #5793 and part of #6072.
This PR refactors most of our printing module. Most of the contents were taken verbatim from aeppl/printing.py as it was not ported in #6334; I was unable to retrieve the Git history from that file and the AePPL license is available in the beginning of the printing module now.
While tensor variables are no longer expected to have a
str_repr
method attached, the main benefits are that 1) printing is done with respect to Ops (instead of seeingf()
s as per #6261) and 2) there will be a default printing mechanism for newly created distributions due to the dispatching approach, although how good the latter will be remains unclear to me. This PR also makes use of the printing module in PyTensor.I am creating this PR "early on" to receive feedback, especially in how we want to display some newly created symbolic distributions and how the API will work. This refactoring took quite some time, so I also want to check in that this is going in the right direction as there are still many elements to work on. Tests will fail, for now at least. This will be a slow WIP.
To-do's:
CensoredPrinter
CensoredPrinter
to the distribution being censored (e.g. CensoredNormal)MarginalMixturePrinter
when using single component dispatching