-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Numpy docs hmc #2405
Numpy docs hmc #2405
Conversation
(also, removing attribution to @jsalvatier is not meant as a slight -- I think the git history provides a record of credit, and this is interpreted by numpy as a malformed module docstring.) |
@@ -3,3 +3,7 @@ testpaths = pymc3/tests | |||
|
|||
[coverage:run] | |||
omit = *examples* | |||
|
|||
[pydocstyle] | |||
add-ignore = D100,D104 |
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.
what is this for?
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'll add a comment -- D100 wants a docstring at the top of every file, and D104 wants a docstring in every __init__.py
file
pymc3/step_methods/hmc/hmc.py
Outdated
@@ -22,11 +18,17 @@ def unif(step_size, elow=.85, ehigh=1.15): | |||
|
|||
|
|||
class HamiltonianMC(BaseHMC): | |||
R"""A sampler for continuous variables based on Hamiltonian mechanics. | |||
|
|||
See NUTS sampler for automatically tuned stopping time. |
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.
stopping time and step size adaptation.
pymc3/step_methods/hmc/nuts.py
Outdated
@@ -90,7 +91,8 @@ class NUTS(BaseHMC): | |||
def __init__(self, vars=None, Emax=1000, target_accept=0.8, | |||
gamma=0.05, k=0.75, t0=10, adapt_step_size=True, | |||
max_treedepth=10, on_error='summary', **kwargs): | |||
R""" | |||
R"""Set up the No-U-Turn sampler. |
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 standard says that we shouldn't document the arguments in __init__
and in the class doc string.
https://github.com/numpy/numpy/blob/master/doc/HOWTO_DOCUMENT.rst.txt#class-docstring
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.
It looks like most of the class doc string is documenting the sampler_stats
return object -- I hadn't seen that there is an Attribute
section for class docstrings though, which is probably where the sampler stats should go...
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.
Actually, that is a funny thing to document in __init__
since it is an attribute it provides on the trace
object. It makes sense to me to leave it where it is, and not adding an Attribute
section.
Thanks for writing all those doc strings! |
Don't we want new line after """? |
Created on Mar 7, 2011 | ||
|
||
@author: johnsalvatier | ||
''' | ||
from ..arraystep import metrop_select, Competence | ||
from .base_hmc import BaseHMC | ||
from pymc3.vartypes import discrete_types | ||
from pymc3.theanof import floatX |
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.
Numpy should be imported before local imports by pep8
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 updated this here -- it is actually a pylint check (wrong-import-order
) that I can maybe try adding tomorrow, but that is a ton of violations!
1756260
to
1259063
Compare
1259063
to
ee199ef
Compare
Going to merge these once tests pass, since the rebasing is a pain and just making sure that the docs follow the functions around! |
This is great @ColCarroll. |
* Conform to numpy style docstrings in hmc submodule * Accidentally messed with pylintrc * Comments * Rebase * Rebase again
As was foretold in #2403
@aseyboldt you might take particular offense to some of the docstrings -- would love any nitpicks.