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

Working on Deprecate SumTo1 Transform #7059

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
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 pymc/distributions/transforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ def __getattr__(name):
warnings.warn(f"{name} has been deprecated, use sum_to_1 instead.", FutureWarning)
return sum_to_1

if name == "sum_to_1":
warnings.warn("sum_to_1 has been deprecated, use simplex instead.", FutureWarning)
return simplex

if name == "RVTransform":
warnings.warn("RVTransform has been renamed to Transform", FutureWarning)
return Transform
Expand Down Expand Up @@ -334,6 +338,7 @@ def log_jac_det(self, value, *rv_inputs):
Instantiation of :class:`pymc.logprob.transforms.LogTransform`
for use in the ``transform`` argument of a random variable."""

# Deprecated
sum_to_1 = SumTo1()
sum_to_1.__doc__ = """
Instantiation of :class:`pymc.distributions.transforms.SumTo1`
Expand Down
3 changes: 3 additions & 0 deletions tests/distributions/test_transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -675,3 +675,6 @@ def test_deprecated_ndim_supp_transforms():

with pytest.warns(FutureWarning, match="deprecated"):
assert tr.multivariate_sum_to_1 == tr.sum_to_1

with pytest.warns(FutureWarning, match="deprecated"):
assert tr.sum_to_1 == tr.simplex