-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Fix latex repr of symbolic distributions #6231
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
Conversation
* Do not put \operatorname inside \text * add test
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #6231 +/- ##
=======================================
Coverage 94.14% 94.14%
=======================================
Files 100 100
Lines 21235 21239 +4
=======================================
+ Hits 19992 19996 +4
Misses 1243 1243
|
…-devs#6232) * Adding option to include transformed variables in InferenceData Co-authored-by: Michael Osthege <[email protected]>
* remove them from the string borders since they always represent the math environment
* remove them from the string borders since they always represent the math environment * fix tests to check the correct behavior
# Conflicts: # pymc/tests/test_printing.py
Is anything else needed here? |
# Conflicts: # pymc/tests/test_printing.py
I've already solved conflicts twice because people keep adding wrong tests for the latex printing. |
That sometimes happens, a reviewer may be able to get to another PR and merge it before yours. Sorry for the trouble, but it's also something one must get used to :) |
Yes, I understand that, I don't want to look upset. I'm just saying that
the current tests in that file, and the ones are being added to it, are
(partially) testing the wrong behavior, which is the reason why that issue
exists in the first place.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM in general, though the testing should be fixed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Looks good to me, thanks for adding the tests so quickly. I'll leave merging to someone else (eg @ricardoV94) because it's been a while for me. |
That was easy, I added as tests the exact same distributions used in the issue to show the problem. This way it's also possible to reference back to them, should something go wrong in the future. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thanks for your help! Glad that you were able to solve the other conflicts following the merge of #6242
return r"f(" + ", ".join([n.strip("$") for n in names]) + ")" | ||
|
||
|
||
def _latex_text_format(text: str) -> str: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay for now, but I have a sense that this can be simplified since you're always using it on an output of _latex_escape
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can add the call to _latex_escape(text.strip("$")
inside _latex_text_format
and call this also in the other 2 occurrences of _latex_escape
. Then, we can also remove the naked \text{
in there.
@mattiadg there appears to be one more conflict? Would be great to push this over the finish line as we have a release coming up! |
Sure, I will do it this evening or tomorrow
|
# Conflicts: # pymc/tests/test_printing.py
done |
Nice, thank you for fixing these @mattiadg ! |
Fix #6202
What is this PR about?
When a symbolic distribution is defined as parameter of another one, the latex representation is broken.
This PR aims to solve this.
I think that the new failing tests are testing the wrong behavior, this is a draft because I would like someone more experienced with this to check on them.
What I'm doing is to remove
\operatorname
from inside\text
because it's wrong.Checklist
Major / Breaking Changes
Bugfixes / New features
Docs / Maintenance