pymc-devs / pymc-devs/pymc

BUG: `tune=False` is not respected for sequential sampling

Open
#6,512 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
9.8k
Forks
2.3k
Avg merge
21h 39m
Merged PRs (30d)
5

Description

Describe the issue:

Single process MCMC sets step.tune = True any time the number of tuning steps is nonzero (due to this line).

Discovered this when trying to debug a model that was throwing exceptions during tuning, regardless of whether or not I enabled or disabled tuning at the step method constructor.

This is not the same behavior as multiprocess MCMC (which does no such adjustment). And further, it has different effects depending on the step method. For DEMetropolis(Z), setting tune=True actually doesn't cause tuning to happen, because the tuning target is set to None (rather than lambda or scaling). But in Slice, and I think most others, tuning does get turned back on.

Due to these discrepancies I suppose this is a bug.

Reproduceable code example:
<error noticed in the debugger>
Error message:

No response

PyMC version information:
%watermark -p pymc,pytensor
pymc    : 5.0.2
pytensor: 2.9.1
Context for the issue:

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in pymc/sampling/mcmc.py around lines 812-814 and trace where single-process sampling sets step.tune. Compare that behavior with multiprocess MCMC and the step-method cases described for DEMetropolis(Z) and Slice. Done means sequential sampling respects the constructor's tune=False setting consistently.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.