Skip to content

Commit 371e944

Browse files
authored
Make StudentT/AsymmetricLaplace .dist() signatures consistent (#5628)
* make dist signatures consistent * update docstring and release notes
1 parent 40aefa9 commit 371e944

File tree

3 files changed

+13
-7
lines changed

3 files changed

+13
-7
lines changed

Diff for: RELEASE-NOTES.md

+5
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ Also check out the [milestones](https://github.com/pymc-devs/pymc/milestones) fo
2626

2727
All of the above apply to:
2828

29+
Signature and default parameters changed for several distributions (see [#5628](https://github.com/pymc-devs/pymc/pull/5628)):
30+
- `pm.StudentT` now requires either `sigma` or `lam` as kwarg
31+
- `pm.StudentT` now requires `nu` to be specified (no longer defaults to 1)
32+
- `pm.AsymmetricLaplace` positional arguments re-ordered
33+
- `pm.AsymmetricLaplace` now requires `mu` to be specified (no longer defaults to 0)
2934
- BART was removed [#5566](https://github.com/pymc-devs/pymc/pull/5566). It is now available from [pymc-experimental](https://github.com/pymc-devs/pymc-experimental)
3035
- `BaseStochasticGradient` was removed (see [#5630](https://github.com/pymc-devs/pymc/pull/5630))
3136
- ⚠ The library is now named, installed and imported as "pymc". For example: `pip install pymc`.

Diff for: pymc/distributions/continuous.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -1646,12 +1646,12 @@ class AsymmetricLaplace(Continuous):
16461646
16471647
Parameters
16481648
----------
1649-
b : tensor_like of float
1650-
Scale parameter (b > 0).
16511649
kappa : tensor_like of float
16521650
Symmetry parameter (kappa > 0).
1653-
mu : tensor_like of float, default 0
1651+
mu : tensor_like of float
16541652
Location parameter.
1653+
b : tensor_like of float
1654+
Scale parameter (b > 0).
16551655
16561656
See Also:
16571657
--------
@@ -1660,7 +1660,7 @@ class AsymmetricLaplace(Continuous):
16601660
rv_op = asymmetriclaplace
16611661

16621662
@classmethod
1663-
def dist(cls, b, kappa, mu=0, *args, **kwargs):
1663+
def dist(cls, kappa, mu, b, *args, **kwargs):
16641664
b = at.as_tensor_variable(floatX(b))
16651665
kappa = at.as_tensor_variable(floatX(kappa))
16661666
mu = mu = at.as_tensor_variable(floatX(mu))
@@ -1899,7 +1899,7 @@ class StudentT(Continuous):
18991899
rv_op = studentt
19001900

19011901
@classmethod
1902-
def dist(cls, nu, mu=0, lam=None, sigma=None, *args, **kwargs):
1902+
def dist(cls, nu, mu=0, *, sigma=None, lam=None, **kwargs):
19031903
nu = at.as_tensor_variable(floatX(nu))
19041904
lam, sigma = get_tau_sigma(tau=lam, sigma=sigma)
19051905
sigma = at.as_tensor_variable(sigma)
@@ -2712,7 +2712,7 @@ class HalfStudentT(PositiveContinuous):
27122712
27132713
Parameters
27142714
----------
2715-
nu : tensor_like of float, default 1
2715+
nu : tensor_like of float
27162716
Degrees of freedom, also known as normality parameter (nu > 0).
27172717
sigma : tensor_like of float, optional
27182718
Scale parameter (sigma > 0). Converges to the standard deviation as nu
@@ -2735,7 +2735,7 @@ class HalfStudentT(PositiveContinuous):
27352735
rv_op = halfstudentt
27362736

27372737
@classmethod
2738-
def dist(cls, nu=1, sigma=None, lam=None, *args, **kwargs):
2738+
def dist(cls, nu, sigma=None, lam=None, *args, **kwargs):
27392739
nu = at.as_tensor_variable(floatX(nu))
27402740
lam, sigma = get_tau_sigma(lam, sigma)
27412741
sigma = at.as_tensor_variable(sigma)

Diff for: pymc/tests/test_distributions.py

+1
Original file line numberDiff line numberDiff line change
@@ -1612,6 +1612,7 @@ def test_half_studentt(self):
16121612
Rplus,
16131613
{"sigma": Rplus},
16141614
lambda value, sigma: sp.halfcauchy.logpdf(value, 0, sigma),
1615+
extra_args={"nu": 1},
16151616
)
16161617

16171618
def test_skew_normal(self):

0 commit comments

Comments
 (0)