Skip to content

Commit 3b672e1

Browse files
committed
Merge pull request #226 from pymc-devs/normalargs
Add `sd` argument to Normal
2 parents 7797ff5 + d17412b commit 3b672e1

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

pymc/distributions/continuous.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def logp(value):
6868
return locals()
6969

7070
@tensordist(continuous)
71-
def Normal(mu=0.0, tau=1.0):
71+
def Normal(mu=0.0, tau=None, sd=None):
7272
"""
7373
Normal log-likelihood.
7474
@@ -82,13 +82,24 @@ def Normal(mu=0.0, tau=1.0):
8282
tau : float
8383
Precision of the distribution, which corresponds to
8484
:math:`1/\sigma^2` (tau > 0).
85+
sd : float
86+
Standard deviation of the distribution. Alternative parameterization.
8587
8688
.. note::
8789
- :math:`E(X) = \mu`
8890
- :math:`Var(X) = 1/\tau`
8991
9092
"""
9193

94+
if tau is None :
95+
if sd is None:
96+
tau = 1.
97+
else:
98+
tau = sd**-2
99+
else:
100+
if sd is not None:
101+
raise ValueError("Can't pass both tau and sd")
102+
92103
def logp(value):
93104

94105
return bound(

pymc/tuning/starting.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def find_MAP(start = None, vars=None, fmin = optimize.fmin_bfgs, return_raw = Fa
2323
vars : list
2424
List of variables to set to MAP point (Defaults to all continuous).
2525
fmin : function
26-
Optimization algorithm (Defaults to `scipy.optimize.fmin_l_bfgs_b`).
26+
Optimization algorithm (Defaults to `scipy.optimize.fmin_bfgs`).
2727
return_raw : Bool
2828
Whether to return extra value returned by fmin (Defaults to False)
2929
model : Model (optional if in `with` context)

0 commit comments

Comments
 (0)