Skip to content

Commit 617867d

Browse files
Backwards-compatible rename LognormalLogNormal
1 parent 80dae6b commit 617867d

File tree

3 files changed

+15
-11
lines changed

3 files changed

+15
-11
lines changed

RELEASE-NOTES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
+ The `pm.logp(rv, x)` syntax is now available and recommended to make your model code `v4`-ready. Note that this backport is just an alias and much less capable than what's available with `pymc >=4` (see [#5083](https://github.com/pymc-devs/pymc/pulls/5083)).
66
+ The `pm.Distribution(testval=...)` kwarg was deprecated and will be replaced by `pm.Distribution(initval=...)`in `pymc >=4` (see [#5226](https://github.com/pymc-devs/pymc/pulls/5226)).
77
+ The `pm.sample(start=...)` kwarg was deprecated and will be replaced by `pm.sample(initvals=...)`in `pymc >=4` (see [#5226](https://github.com/pymc-devs/pymc/pulls/5226)).
8+
+ `pm.Lognormal` is now available as an alias for `pm.Lognormal` (see [#5389](https://github.com/pymc-devs/pymc/pull/5389)).
89

910
### Bugfixes
1011
+ A hotfix is applied on import to remain compatible with NumPy 1.22 (see [#5316](https://github.com/pymc-devs/pymc/pull/5316)).

pymc3/distributions/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
Laplace,
3636
Logistic,
3737
LogitNormal,
38-
Lognormal,
38+
LogNormal,
3939
Moyal,
4040
Normal,
4141
Pareto,
@@ -119,7 +119,7 @@
119119
"Gamma",
120120
"Weibull",
121121
"Bound",
122-
"Lognormal",
122+
"LogNormal",
123123
"HalfStudentT",
124124
"ChiSquared",
125125
"HalfNormal",

pymc3/distributions/continuous.py

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
"Gamma",
6363
"Weibull",
6464
"HalfStudentT",
65-
"Lognormal",
65+
"LogNormal",
6666
"ChiSquared",
6767
"HalfNormal",
6868
"Wald",
@@ -1778,7 +1778,7 @@ def logp(self, value):
17781778
)
17791779

17801780

1781-
class Lognormal(PositiveContinuous):
1781+
class LogNormal(PositiveContinuous):
17821782
r"""
17831783
Log-normal log-likelihood.
17841784
@@ -1834,10 +1834,10 @@ class Lognormal(PositiveContinuous):
18341834
18351835
# Example to show that we pass in only ``sigma`` or ``tau`` but not both.
18361836
with pm.Model():
1837-
x = pm.Lognormal('x', mu=2, sigma=30)
1837+
x = pm.LogNormal('x', mu=2, sigma=30)
18381838
18391839
with pm.Model():
1840-
x = pm.Lognormal('x', mu=2, tau=1/100)
1840+
x = pm.LogNormal('x', mu=2, tau=1/100)
18411841
"""
18421842

18431843
def __init__(self, mu=0, sigma=None, tau=None, sd=None, *args, **kwargs):
@@ -1856,16 +1856,16 @@ def __init__(self, mu=0, sigma=None, tau=None, sd=None, *args, **kwargs):
18561856
self.mode = tt.exp(self.mu - 1.0 / self.tau)
18571857
self.variance = (tt.exp(1.0 / self.tau) - 1) * tt.exp(2 * self.mu + 1.0 / self.tau)
18581858

1859-
assert_negative_support(tau, "tau", "Lognormal")
1860-
assert_negative_support(sigma, "sigma", "Lognormal")
1859+
assert_negative_support(tau, "tau", "LogNormal")
1860+
assert_negative_support(sigma, "sigma", "LogNormal")
18611861

18621862
def _random(self, mu, tau, size=None):
18631863
samples = np.random.normal(size=size)
18641864
return np.exp(mu + (tau ** -0.5) * samples)
18651865

18661866
def random(self, point=None, size=None):
18671867
"""
1868-
Draw random values from Lognormal distribution.
1868+
Draw random values from LogNormal distribution.
18691869
18701870
Parameters
18711871
----------
@@ -1885,7 +1885,7 @@ def random(self, point=None, size=None):
18851885

18861886
def logp(self, value):
18871887
"""
1888-
Calculate log-probability of Lognormal distribution at specified value.
1888+
Calculate log-probability of LogNormal distribution at specified value.
18891889
18901890
Parameters
18911891
----------
@@ -1911,7 +1911,7 @@ def _distr_parameters_for_repr(self):
19111911

19121912
def logcdf(self, value):
19131913
"""
1914-
Compute the log of the cumulative distribution function for Lognormal distribution
1914+
Compute the log of the cumulative distribution function for LogNormal distribution
19151915
at the specified value.
19161916
19171917
Parameters
@@ -1935,6 +1935,9 @@ def logcdf(self, value):
19351935
)
19361936

19371937

1938+
Lognormal = LogNormal
1939+
1940+
19381941
class StudentT(Continuous):
19391942
r"""
19401943
Student's T log-likelihood.

0 commit comments

Comments
 (0)