Skip to content

Commit

Permalink
Revert "Suggest var_names when using deprecated API for partial tra…
Browse files Browse the repository at this point in the history
…ces (pymc-devs#7289)"

This reverts commit 881030a.
  • Loading branch information
mkusnetsov authored May 8, 2024
1 parent e42d35a commit 8a6a27e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 4 additions & 1 deletion pymc/sampling/mcmc.py
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,10 @@ def sample(
else:
kwargs["nuts"] = {"target_accept": kwargs.pop("target_accept")}
if isinstance(trace, list):
raise ValueError("Please use `var_names` keyword argument for partial traces.")
raise DeprecationWarning(
"We have removed support for partial traces because it simplified things."
" Please open an issue if & why this is a problem for you."
)

model = modelcontext(model)
if not model.free_RVs:
Expand Down
4 changes: 2 additions & 2 deletions tests/sampling/test_mcmc.py
Original file line number Diff line number Diff line change
Expand Up @@ -507,11 +507,11 @@ def test_empty_model():
error.match("any free variables")


def test_partial_trace_with_trace_unsupported():
def test_partial_trace_unsupported():
with pm.Model() as model:
a = pm.Normal("a", mu=0, sigma=1)
b = pm.Normal("b", mu=0, sigma=1)
with pytest.raises(ValueError, match="var_names"):
with pytest.raises(DeprecationWarning, match="removed support"):
pm.sample(trace=[a])


Expand Down

0 comments on commit 8a6a27e

Please sign in to comment.