Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make StudentT/AsymmetricLaplace .dist() signatures consistent #5628

Merged
merged 22 commits into from
Apr 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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):
ricardoV94 marked this conversation as resolved.
Show resolved Hide resolved
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 @@ -1617,6 +1617,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