-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Add LaTeX repr for distributions #2201
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
pymc3/distributions/continuous.py
Outdated
if dist is None: | ||
dist = self | ||
sd = dist.sd | ||
return r'$%s \sim \text{HalfNormal}(\mathit{sd}=%s)$' % (name, |
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.
how about new-style r'{}'.format(...)
? https://pyformat.info/
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.
The new style does not like strings with curly braces in them. This was easier.
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.
OK, figured it out.
Odd failures related to multiprocessing in 2.7. |
The failures occur because of usage Multiprocessing tries to pickle resulting function objects, but fails because bound methods are not pickleable in Python 2, although they are pickleable in Python 3. For example, this code works with Python 3, but not Python 2: import pickle
class Foo:
def bar(self):
return 3
pickle.dumps(Foo().bar) I tried to replace invocations of |
Thanks @a-rodin. The best approach is to do a PR onto this PR (specifically, the |
Avoid storing bound methods as variables to prevent pickling problems
pymc3/distributions/timeseries.py
Outdated
|
||
|
||
class GARCH11(distribution.Continuous): | ||
""" | ||
GARCH(1,1) with Normal innovations. The model is specified by | ||
|
||
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 think these should not be here, not quite sure.
Looks like the whitespaces are still there. |
It appears that My Favorite Text Editor sucks at whitespace removal, even inserting it in some places it did not exist. |
Should be good to go now. |
would this be reasonable to propagate to models and maybe even the traces? It looks like it is more work than |
I think having a |
vote for renaming |
We aren’t at liberty to change it because they are hooks used by IPython. If you change the name they won’t work. |
This PR adds LaTeX output when distributions are shown in Jupyter notebooks. The initial commit has this implemented for all continuous variables. Discrete, MV to come.