Skip to content

Commit

Permalink
Remove deprecated arguments in smc/sampling.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Armavica authored and mkusnetsov committed Oct 26, 2024
1 parent b7e0054 commit 7e2d9e2
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 70 deletions.
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
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

0 comments on commit 7e2d9e2

Please sign in to comment.