From 58bdaa8b493010d375c9fa2e11e593229e201249 Mon Sep 17 00:00:00 2001 From: nyeshlur <72169901+nyeshlur@users.noreply.github.com> Date: Sun, 10 Dec 2023 09:17:17 -0800 Subject: [PATCH 1/2] working on futurewarning for sumto1 --- pymc/distributions/transforms.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pymc/distributions/transforms.py b/pymc/distributions/transforms.py index bdb63285c9..99a0554901 100644 --- a/pymc/distributions/transforms.py +++ b/pymc/distributions/transforms.py @@ -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 will be deprecated, use simplex instead.", FutureWarning) + # return sum_to_1 + if name == "RVTransform": warnings.warn("RVTransform has been renamed to Transform", FutureWarning) return Transform From a3bc9d2fb44dd53131d58e5ff6ab07154d153101 Mon Sep 17 00:00:00 2001 From: nyeshlur <72169901+nyeshlur@users.noreply.github.com> Date: Wed, 13 Dec 2023 11:23:01 -0800 Subject: [PATCH 2/2] updated futurewarning and test --- pymc/distributions/transforms.py | 7 ++++--- tests/distributions/test_transform.py | 3 +++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/pymc/distributions/transforms.py b/pymc/distributions/transforms.py index 99a0554901..b3c23b7e00 100644 --- a/pymc/distributions/transforms.py +++ b/pymc/distributions/transforms.py @@ -61,9 +61,9 @@ 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 will be deprecated, use simplex 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) @@ -338,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` diff --git a/tests/distributions/test_transform.py b/tests/distributions/test_transform.py index 8196c2623c..3bf0c8baf1 100644 --- a/tests/distributions/test_transform.py +++ b/tests/distributions/test_transform.py @@ -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