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

Remove deprecated features #7533

Merged
merged 4 commits into from
Oct 10, 2024
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
11 changes: 0 additions & 11 deletions pymc/distributions/continuous.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,17 +199,6 @@ def transform_params(*args):
return transforms.Interval(bounds_fn=transform_params)


def assert_negative_support(var, label, distname, value=-1e-6):
warnings.warn(
"The assert_negative_support function will be deprecated in future versions!"
" See https://github.com/pymc-devs/pymc/issues/5162",
DeprecationWarning,
)
msg = f"The variable specified for {label} has negative support for {distname}, "
msg += "likely making it unsuitable for this parameter."
return Assert(msg)(var, pt.all(pt.ge(var, 0.0)))


def get_tau_sigma(
tau: TensorLike | None = None, sigma: TensorLike | None = None
) -> tuple[TensorVariable, TensorVariable]:
Expand Down
11 changes: 1 addition & 10 deletions pymc/distributions/multivariate.py
Original file line number Diff line number Diff line change
Expand Up @@ -2709,7 +2709,6 @@ class ZeroSumNormal(Distribution):
n_zerosum_axes: int, defaults to 1
Number of axes along which the zero-sum constraint is enforced, starting from the rightmost position.
Defaults to 1, i.e the rightmost axis.
zerosum_axes: int, deprecated please use n_zerosum_axes as its successor
dims: sequence of strings, optional
Dimension names of the distribution. Works the same as for other PyMC distributions.
Necessary if ``shape`` is not passed.
Expand Down Expand Up @@ -2749,15 +2748,7 @@ class ZeroSumNormal(Distribution):
rv_type = ZeroSumNormalRV
rv_op = ZeroSumNormalRV.rv_op

def __new__(
cls, *args, zerosum_axes=None, n_zerosum_axes=None, support_shape=None, dims=None, **kwargs
):
if zerosum_axes is not None:
n_zerosum_axes = zerosum_axes
warnings.warn(
"The 'zerosum_axes' parameter is deprecated. Use 'n_zerosum_axes' instead.",
DeprecationWarning,
)
def __new__(cls, *args, n_zerosum_axes=None, support_shape=None, dims=None, **kwargs):
if dims is not None or kwargs.get("observed") is not None:
n_zerosum_axes = cls.check_zerosum_axes(n_zerosum_axes)

Expand Down
20 changes: 0 additions & 20 deletions pymc/sampling_jax.py

This file was deleted.

36 changes: 0 additions & 36 deletions pymc/smc/sampling.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import logging
import multiprocessing
import time
import warnings

from collections import defaultdict
from concurrent.futures import ProcessPoolExecutor, wait
Expand Down Expand Up @@ -150,41 +149,6 @@ def sample_smc(
`link <http://ascelibrary.org/doi/abs/10.1061/%28ASCE%290733-9399
%282007%29133:7%28816%29>`__
"""
if isinstance(kernel, str) and kernel.lower() in ("abc", "metropolis"):
warnings.warn(
f'The kernel string argument "{kernel}" in sample_smc has been deprecated. '
f"It is no longer needed to distinguish between `abc` and `metropolis`",
FutureWarning,
stacklevel=2,
)
kernel = IMH

if kernel_kwargs.pop("save_sim_data", None) is not None:
warnings.warn(
"save_sim_data has been deprecated. Use pm.sample_posterior_predictive "
"to obtain the same type of samples.",
FutureWarning,
stacklevel=2,
)

if kernel_kwargs.pop("save_log_pseudolikelihood", None) is not None:
warnings.warn(
"save_log_pseudolikelihood has been deprecated. This information is "
"now saved as log_likelihood in models with Simulator distributions.",
FutureWarning,
stacklevel=2,
)

parallel = kernel_kwargs.pop("parallel", None)
if parallel is not None:
warnings.warn(
"The argument parallel is deprecated, use the argument cores instead.",
FutureWarning,
stacklevel=2,
)
if parallel is False:
cores = 1

if cores is None:
cores = _cpu_count()

Expand Down
7 changes: 0 additions & 7 deletions tests/sampling/test_jax.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,6 @@
)


def test_old_import_route():
import pymc.sampling.jax as new_sj
import pymc.sampling_jax as old_sj

assert set(new_sj.__all__) <= set(dir(old_sj))


def test_jax_PosDefMatrix():
x = pt.tensor(name="x", shape=(2, 2), dtype="float32")
matrix_pos_def = PosDefMatrix()
Expand Down
34 changes: 0 additions & 34 deletions tests/smc/test_smc.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,40 +236,6 @@ def test_convergence_checks(self, caplog):
pm.sample_smc(draws=99, progressbar=not _IS_WINDOWS)
assert "The number of samples is too small" in caplog.text

def test_deprecated_parallel_arg(self):
with self.fast_model:
with pytest.warns(
FutureWarning,
match="The argument parallel is deprecated",
):
pm.sample_smc(draws=10, chains=1, parallel=False)

def test_deprecated_abc_args(self):
with self.fast_model:
with pytest.warns(
FutureWarning,
match='The kernel string argument "ABC" in sample_smc has been deprecated',
):
pm.sample_smc(draws=10, chains=1, kernel="ABC")

with pytest.warns(
FutureWarning,
match='The kernel string argument "Metropolis" in sample_smc has been deprecated',
):
pm.sample_smc(draws=10, chains=1, kernel="Metropolis")

with pytest.warns(
FutureWarning,
match="save_sim_data has been deprecated",
):
pm.sample_smc(draws=10, chains=1, save_sim_data=True)

with pytest.warns(
FutureWarning,
match="save_log_pseudolikelihood has been deprecated",
):
pm.sample_smc(draws=10, chains=1, save_log_pseudolikelihood=True)

def test_ordered(self):
"""
Test that initial population respects custom initval, especially when applied
Expand Down
Loading