diff --git a/pymc/backends/tracetab.py b/pymc/backends/tracetab.py index b74c88b741..ac8b1031ea 100644 --- a/pymc/backends/tracetab.py +++ b/pymc/backends/tracetab.py @@ -45,7 +45,7 @@ def trace_to_dataframe(trace, chains=None, varnames=None, include_transformed=Fa "The `trace_to_dataframe` function will soon be removed. " "Please use ArviZ to save traces. " "If you have good reasons for using the `trace_to_dataframe` function, file an issue and tell us about them. ", - DeprecationWarning, + FutureWarning, ) var_shapes = trace._straces[0].var_shapes diff --git a/pymc/distributions/dist_math.py b/pymc/distributions/dist_math.py index 5946da5a42..6a76b49427 100644 --- a/pymc/distributions/dist_math.py +++ b/pymc/distributions/dist_math.py @@ -510,7 +510,7 @@ def log_i0(x): def incomplete_beta(a, b, value): warnings.warn( "incomplete_beta has been deprecated. Use aesara.tensor.betainc instead.", - DeprecationWarning, + FutureWarning, stacklevel=2, ) return at.betainc(a, b, value) diff --git a/pymc/distributions/distribution.py b/pymc/distributions/distribution.py index e1df678674..449cc61da7 100644 --- a/pymc/distributions/distribution.py +++ b/pymc/distributions/distribution.py @@ -78,7 +78,7 @@ def __new__(cls, name, bases, clsdict): def _random(*args, **kwargs): warnings.warn( "The old `Distribution.random` interface is deprecated.", - DeprecationWarning, + FutureWarning, stacklevel=2, ) return clsdict["random"](*args, **kwargs) @@ -204,7 +204,7 @@ def __new__( initval = kwargs.pop("testval") warnings.warn( "The `testval` argument is deprecated; use `initval`.", - DeprecationWarning, + FutureWarning, stacklevel=2, ) @@ -296,7 +296,7 @@ def dist( "The `.dist(testval=...)` argument is deprecated and has no effect. " "Initial values for sampling/optimization can be specified with `initval` in a modelcontext. " "For using Aesara's test value features, you must assign the `.tag.test_value` yourself.", - DeprecationWarning, + FutureWarning, stacklevel=2, ) if "initval" in kwargs: diff --git a/pymc/distributions/multivariate.py b/pymc/distributions/multivariate.py index 81afd1a614..cfa372e037 100644 --- a/pymc/distributions/multivariate.py +++ b/pymc/distributions/multivariate.py @@ -1410,7 +1410,7 @@ def __init__(self, eta=None, n=None, p=None, transform="interval", *args, **kwar "Parameters to LKJCorr have changed: shape parameter n -> eta " "dimension parameter p -> n. Please update your code. " "Automatically re-assigning parameters for backwards compatibility.", - DeprecationWarning, + FutureWarning, ) self.n = p self.eta = n @@ -1435,7 +1435,7 @@ def __init__(self, eta=None, n=None, p=None, transform="interval", *args, **kwar warnings.warn( "Parameters in LKJCorr have been rename: shape parameter n -> eta " "dimension parameter p -> n. Please double check your initialization.", - DeprecationWarning, + FutureWarning, ) self.tri_index = np.zeros([n, n], dtype="int32") self.tri_index[np.triu_indices(n, k=1)] = np.arange(shape) @@ -1665,7 +1665,7 @@ def dist( "The shape argument in MatrixNormal is deprecated and will be ignored." "MatrixNormal automatically derives the shape" "from row and column matrix dimensions.", - DeprecationWarning, + FutureWarning, ) # Among-row matrices diff --git a/pymc/gp/gp.py b/pymc/gp/gp.py index 9f913474d4..0ed4d719f9 100644 --- a/pymc/gp/gp.py +++ b/pymc/gp/gp.py @@ -725,7 +725,7 @@ def marginal_likelihood(self, name, X, Xu, y, noise=None, is_observed=True, **kw self.sigma = sigma warnings.warn( "The 'sigma' argument has been deprecated. Use 'noise' instead.", - DeprecationWarning, + FutureWarning, ) else: self.sigma = noise diff --git a/pymc/math.py b/pymc/math.py index 1c765ebad3..cd9587e66a 100644 --- a/pymc/math.py +++ b/pymc/math.py @@ -205,7 +205,7 @@ def invlogit(x, eps=None): if eps is not None: warnings.warn( "pymc.math.invlogit no longer supports the ``eps`` argument and it will be ignored.", - DeprecationWarning, + FutureWarning, stacklevel=2, ) return at.sigmoid(x) diff --git a/pymc/model.py b/pymc/model.py index 0fdc282503..92583624af 100644 --- a/pymc/model.py +++ b/pymc/model.py @@ -838,7 +838,7 @@ def datalogpt(self): def vars(self): warnings.warn( "Model.vars has been deprecated. Use Model.value_vars instead.", - DeprecationWarning, + FutureWarning, ) return self.value_vars @@ -942,7 +942,7 @@ def test_point(self) -> Dict[str, np.ndarray]: """Deprecated alias for `Model.recompute_initial_point(seed=None)`.""" warnings.warn( "`Model.test_point` has been deprecated. Use `Model.recompute_initial_point(seed=None)`.", - DeprecationWarning, + FutureWarning, ) return self.recompute_initial_point() @@ -951,7 +951,7 @@ def initial_point(self) -> Dict[str, np.ndarray]: """Deprecated alias for `Model.recompute_initial_point(seed=None)`.""" warnings.warn( "`Model.initial_point` has been deprecated. Use `Model.recompute_initial_point(seed=None)`.", - DeprecationWarning, + FutureWarning, ) return self.recompute_initial_point() @@ -1548,7 +1548,7 @@ def update_start_vals(self, a: Dict[str, np.ndarray], b: Dict[str, np.ndarray]): conditional on the values of `b` and stored in `b`. """ - raise DeprecationWarning( + raise FutureWarning( "The `Model.update_start_vals` method was removed." " To change initial values you may set the items of `Model.initial_values` directly." ) @@ -1630,7 +1630,7 @@ def check_start_vals(self, start): def check_test_point(self, *args, **kwargs): warnings.warn( "`Model.check_test_point` has been deprecated. Use `Model.point_logps` instead.", - DeprecationWarning, + FutureWarning, ) return self.point_logps(*args, **kwargs) diff --git a/pymc/plots/__init__.py b/pymc/plots/__init__.py index 820ce5ca4a..e9c8bcaf39 100644 --- a/pymc/plots/__init__.py +++ b/pymc/plots/__init__.py @@ -36,7 +36,7 @@ def alias_deprecation(func, alias: str): @functools.wraps(func) def wrapped(*args, **kwargs): - raise DeprecationWarning( + raise FutureWarning( f"The function `{alias}` from PyMC was an alias for `{original}` from ArviZ. " "It was removed in PyMC 4.0. " f"Switch to `pymc.{original}` or `arviz.{original}`." diff --git a/pymc/plots/posteriorplot.py b/pymc/plots/posteriorplot.py index f1eaf7ec63..79c4d6c199 100644 --- a/pymc/plots/posteriorplot.py +++ b/pymc/plots/posteriorplot.py @@ -59,7 +59,7 @@ def plot_posterior_predictive_glm( warnings.warn( "The `plot_posterior_predictive_glm` function will migrate to Arviz in a future release. " "\nKeep up to date with `ArviZ `_ for future updates.", - DeprecationWarning, + FutureWarning, ) if lm is None: diff --git a/pymc/sampling.py b/pymc/sampling.py index f4ca9ecc36..184c61f69a 100644 --- a/pymc/sampling.py +++ b/pymc/sampling.py @@ -1650,7 +1650,7 @@ def sample_posterior_predictive( warnings.warn( "In this version, RNG seeding is managed by the Model objects. " "See the `rng_seeder` argument in Model's constructor.", - DeprecationWarning, + FutureWarning, stacklevel=2, ) @@ -1806,7 +1806,7 @@ def sample_posterior_predictive_w( warnings.warn( "In this version, RNG seeding is managed by the Model objects. " "See the `rng_seeder` argument in Model's constructor.", - DeprecationWarning, + FutureWarning, stacklevel=2, ) @@ -1973,7 +1973,7 @@ def sample_prior_predictive( warnings.warn( "In this version, RNG seeding is managed by the Model objects. " "See the `rng_seeder` argument in Model's constructor.", - DeprecationWarning, + FutureWarning, stacklevel=2, ) diff --git a/pymc/smc/sample_smc.py b/pymc/smc/sample_smc.py index 171fd97ae6..d6bea826df 100644 --- a/pymc/smc/sample_smc.py +++ b/pymc/smc/sample_smc.py @@ -151,7 +151,7 @@ def sample_smc( 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`", - DeprecationWarning, + FutureWarning, stacklevel=2, ) kernel = IMH @@ -160,7 +160,7 @@ def sample_smc( warnings.warn( "save_sim_data has been deprecated. Use pm.sample_posterior_predictive " "to obtain the same type of samples.", - DeprecationWarning, + FutureWarning, stacklevel=2, ) @@ -168,7 +168,7 @@ def sample_smc( warnings.warn( "save_log_pseudolikelihood has been deprecated. This information is " "now saved as log_likelihood in models with Simulator distributions.", - DeprecationWarning, + FutureWarning, stacklevel=2, ) @@ -176,7 +176,7 @@ def sample_smc( if parallel is not None: warnings.warn( "The argument parallel is deprecated, use the argument cores instead.", - DeprecationWarning, + FutureWarning, stacklevel=2, ) if parallel is False: diff --git a/pymc/tests/test_dist_math.py b/pymc/tests/test_dist_math.py index e70149b8d5..0adcc3a239 100644 --- a/pymc/tests/test_dist_math.py +++ b/pymc/tests/test_dist_math.py @@ -264,6 +264,6 @@ def ref_multigammaln(a, b): def test_incomplete_beta_deprecation(): - with pytest.warns(DeprecationWarning, match="incomplete_beta has been deprecated"): + with pytest.warns(FutureWarning, match="incomplete_beta has been deprecated"): res = incomplete_beta(3, 5, 0.5).eval() assert np.isclose(res, at.betainc(3, 5, 0.5).eval()) diff --git a/pymc/tests/test_distributions_random.py b/pymc/tests/test_distributions_random.py index 04a9100fbe..eafcf58fcd 100644 --- a/pymc/tests/test_distributions_random.py +++ b/pymc/tests/test_distributions_random.py @@ -1635,7 +1635,7 @@ def test_errors(self): logpt(matrixnormal, aesara.tensor.ones((3, 3, 3))) with pm.Model(): - with pytest.warns(DeprecationWarning): + with pytest.warns(FutureWarning): matrixnormal = pm.MatrixNormal( "matnormal", mu=np.random.random((3, 3)), diff --git a/pymc/tests/test_initial_point.py b/pymc/tests/test_initial_point.py index 7ec692da9f..815fd0927a 100644 --- a/pymc/tests/test_initial_point.py +++ b/pymc/tests/test_initial_point.py @@ -32,7 +32,7 @@ def transform_back(rv, transformed) -> np.ndarray: class TestInitvalAssignment: def test_dist_warnings_and_errors(self): - with pytest.warns(DeprecationWarning, match="argument is deprecated and has no effect"): + with pytest.warns(FutureWarning, match="argument is deprecated and has no effect"): rv = pm.Exponential.dist(lam=1, testval=0.5) assert not hasattr(rv.tag, "test_value") @@ -42,7 +42,7 @@ def test_dist_warnings_and_errors(self): def test_new_warnings(self): with pm.Model() as pmodel: - with pytest.warns(DeprecationWarning, match="`testval` argument is deprecated"): + with pytest.warns(FutureWarning, match="`testval` argument is deprecated"): rv = pm.Uniform("u", 0, 1, testval=0.75) initial_point = pmodel.recompute_initial_point(seed=0) assert initial_point["u_interval__"] == transform_fwd(rv, 0.75) diff --git a/pymc/tests/test_math.py b/pymc/tests/test_math.py index 93f927046d..dda0a09e03 100644 --- a/pymc/tests/test_math.py +++ b/pymc/tests/test_math.py @@ -255,7 +255,7 @@ def test_expand_packed_triangular(): def test_invlogit_deprecation_warning(): with pytest.warns( - DeprecationWarning, + FutureWarning, match="pymc.math.invlogit no longer supports the", ): res = invlogit(np.array(-750.0), 1e-5).eval() diff --git a/pymc/tests/test_model.py b/pymc/tests/test_model.py index ff5f052fb7..9c595d02c4 100644 --- a/pymc/tests/test_model.py +++ b/pymc/tests/test_model.py @@ -425,7 +425,7 @@ def test_model_vars(): a = pm.Normal("a") pm.Normal("x", a) - with pytest.warns(DeprecationWarning): + with pytest.warns(FutureWarning): old_vars = model.vars assert old_vars == model.value_vars @@ -495,14 +495,14 @@ def test_initial_point(): a = pm.Uniform("a") x = pm.Normal("x", a) - with pytest.warns(DeprecationWarning): + with pytest.warns(FutureWarning): initial_point = model.test_point assert all(var.name in initial_point for var in model.value_vars) b_initval = np.array(0.3, dtype=aesara.config.floatX) - with pytest.warns(DeprecationWarning), model: + with pytest.warns(FutureWarning), model: b = pm.Uniform("b", testval=b_initval) b_value_var = model.rvs_to_values[b] @@ -526,7 +526,7 @@ def test_point_logps(): a = pm.Uniform("a") pm.Normal("x", a) - with pytest.warns(DeprecationWarning): + with pytest.warns(FutureWarning): logp_vals = model.check_test_point() assert "x" in logp_vals.keys() diff --git a/pymc/tests/test_smc.py b/pymc/tests/test_smc.py index c86b03292e..e012577356 100644 --- a/pymc/tests/test_smc.py +++ b/pymc/tests/test_smc.py @@ -212,7 +212,7 @@ def test_convergence_checks(self): def test_deprecated_parallel_arg(self): with self.fast_model: with pytest.warns( - DeprecationWarning, + FutureWarning, match="The argument parallel is deprecated", ): pm.sample_smc(draws=10, chains=1, parallel=False) @@ -220,25 +220,25 @@ def test_deprecated_parallel_arg(self): def test_deprecated_abc_args(self): with self.fast_model: with pytest.warns( - DeprecationWarning, + 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( - DeprecationWarning, + 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( - DeprecationWarning, + FutureWarning, match="save_sim_data has been deprecated", ): pm.sample_smc(draws=10, chains=1, save_sim_data=True) with pytest.warns( - DeprecationWarning, + FutureWarning, match="save_log_pseudolikelihood has been deprecated", ): pm.sample_smc(draws=10, chains=1, save_log_pseudolikelihood=True) diff --git a/pymc/util.py b/pymc/util.py index 5345c6a287..56e2ba9529 100644 --- a/pymc/util.py +++ b/pymc/util.py @@ -236,7 +236,7 @@ def enhanced(*args, **kwargs): def dataset_to_point_dict(ds: xarray.Dataset) -> List[Dict[str, np.ndarray]]: warnings.warn( "dataset_to_point_dict was renamed to dataset_to_point_list and will be removed!", - DeprecationWarning, + FutureWarning, ) return dataset_to_point_list(ds)