Skip to content

Commit 0b5d6d0

Browse files
committed
Add docstrings for GLM.from_formula and LinearComponent.from_formula.
1 parent 1742d44 commit 0b5d6d0

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

pymc3/glm/linear.py

+21
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,18 @@ def __init__(self, x, y, intercept=True, labels=None,
8585
@classmethod
8686
def from_formula(cls, formula, data, priors=None, vars=None,
8787
name='', model=None, offset=0., eval_env=0):
88+
"""Creates linear component from `patsy` formula.
89+
90+
Parameters
91+
----------
92+
formula : str - a patsy formula
93+
data : a dict-like object that can be used to look up variables referenced
94+
in `formula`
95+
eval_env : either a `patsy.EvalEnvironment` or else a depth represented as
96+
an integer which will be passed to `patsy.EvalEnvironment.capture()`.
97+
See `patsy.dmatrix` and `patsy.EvalEnvironment` for details.
98+
Other arguments are documented in the constructor.
99+
"""
88100
import patsy
89101
eval_env = patsy.EvalEnvironment.capture(eval_env, reference=1)
90102
y, x = patsy.dmatrices(formula, data, eval_env=eval_env)
@@ -142,6 +154,15 @@ def __init__(self, x, y, intercept=True, labels=None,
142154
def from_formula(cls, formula, data, priors=None,
143155
vars=None, family='normal', name='',
144156
model=None, offset=0., eval_env=0):
157+
"""
158+
formula : str - a `patsy` formula
159+
data : a dict-like object that can be used to look up variables referenced
160+
in `formula`
161+
eval_env : either a `patsy.EvalEnvironment` or else a depth represented as
162+
an integer which will be passed to `patsy.EvalEnvironment.capture()`.
163+
See `patsy.dmatrix` and `patsy.EvalEnvironment` for details.
164+
Other arguments are documented in the constructor.
165+
"""
145166
import patsy
146167
eval_env = patsy.EvalEnvironment.capture(eval_env, reference=1)
147168
y, x = patsy.dmatrices(formula, data, eval_env=eval_env)

0 commit comments

Comments
 (0)