Skip to content

Commit

Permalink
Make StudentT/AsymmetricLaplace .dist() signatures consistent (#5628)
Browse files Browse the repository at this point in the history
* make dist signatures consistent
* update docstring and release notes
  • Loading branch information
cluhmann authored Apr 15, 2022
1 parent 40aefa9 commit 371e944
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
5 changes: 5 additions & 0 deletions RELEASE-NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ Also check out the [milestones](https://github.com/pymc-devs/pymc/milestones) fo

All of the above apply to:

Signature and default parameters changed for several distributions (see [#5628](https://github.com/pymc-devs/pymc/pull/5628)):
- `pm.StudentT` now requires either `sigma` or `lam` as kwarg
- `pm.StudentT` now requires `nu` to be specified (no longer defaults to 1)
- `pm.AsymmetricLaplace` positional arguments re-ordered
- `pm.AsymmetricLaplace` now requires `mu` to be specified (no longer defaults to 0)
- 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)
- `BaseStochasticGradient` was removed (see [#5630](https://github.com/pymc-devs/pymc/pull/5630))
- ⚠ The library is now named, installed and imported as "pymc". For example: `pip install pymc`.
Expand Down
14 changes: 7 additions & 7 deletions pymc/distributions/continuous.py
Original file line number Diff line number Diff line change
Expand Up @@ -1646,12 +1646,12 @@ class AsymmetricLaplace(Continuous):
Parameters
----------
b : tensor_like of float
Scale parameter (b > 0).
kappa : tensor_like of float
Symmetry parameter (kappa > 0).
mu : tensor_like of float, default 0
mu : tensor_like of float
Location parameter.
b : tensor_like of float
Scale parameter (b > 0).
See Also:
--------
Expand All @@ -1660,7 +1660,7 @@ class AsymmetricLaplace(Continuous):
rv_op = asymmetriclaplace

@classmethod
def dist(cls, b, kappa, mu=0, *args, **kwargs):
def dist(cls, kappa, mu, b, *args, **kwargs):
b = at.as_tensor_variable(floatX(b))
kappa = at.as_tensor_variable(floatX(kappa))
mu = mu = at.as_tensor_variable(floatX(mu))
Expand Down Expand Up @@ -1899,7 +1899,7 @@ class StudentT(Continuous):
rv_op = studentt

@classmethod
def dist(cls, nu, mu=0, lam=None, sigma=None, *args, **kwargs):
def dist(cls, nu, mu=0, *, sigma=None, lam=None, **kwargs):
nu = at.as_tensor_variable(floatX(nu))
lam, sigma = get_tau_sigma(tau=lam, sigma=sigma)
sigma = at.as_tensor_variable(sigma)
Expand Down Expand Up @@ -2712,7 +2712,7 @@ class HalfStudentT(PositiveContinuous):
Parameters
----------
nu : tensor_like of float, default 1
nu : tensor_like of float
Degrees of freedom, also known as normality parameter (nu > 0).
sigma : tensor_like of float, optional
Scale parameter (sigma > 0). Converges to the standard deviation as nu
Expand All @@ -2735,7 +2735,7 @@ class HalfStudentT(PositiveContinuous):
rv_op = halfstudentt

@classmethod
def dist(cls, nu=1, sigma=None, lam=None, *args, **kwargs):
def dist(cls, nu, sigma=None, lam=None, *args, **kwargs):
nu = at.as_tensor_variable(floatX(nu))
lam, sigma = get_tau_sigma(lam, sigma)
sigma = at.as_tensor_variable(sigma)
Expand Down
1 change: 1 addition & 0 deletions pymc/tests/test_distributions.py
Original file line number Diff line number Diff line change
Expand Up @@ -1612,6 +1612,7 @@ def test_half_studentt(self):
Rplus,
{"sigma": Rplus},
lambda value, sigma: sp.halfcauchy.logpdf(value, 0, sigma),
extra_args={"nu": 1},
)

def test_skew_normal(self):
Expand Down

0 comments on commit 371e944

Please sign in to comment.