Skip to content

Comments

feat(sampling): allow dynamic tuning steps (Fixes #8080)#8110

Open
Jayant-kernel wants to merge 3 commits intopymc-devs:mainfrom
Jayant-kernel:dynamic-tune-steps-fix-8080
Open

feat(sampling): allow dynamic tuning steps (Fixes #8080)#8110
Jayant-kernel wants to merge 3 commits intopymc-devs:mainfrom
Jayant-kernel:dynamic-tune-steps-fix-8080

Conversation

@Jayant-kernel
Copy link

This PR allows step methods to declare their required number of tuning steps, instead of relying on the hardcoded default of 1000. This is efficient for samplers like [CategoricalGibbsMetropolis]

(cci:2://file:///c:/Users/jayan/Desktop/pymc/pymc/step_methods/metropolis.py:687:0-865:38) which require 0 tuning steps.
Changes:

  • Added default_tune_steps attribute to [BlockedStep]
    (cci:2://file:///c:/Users/jayan/Desktop/pymc/pymc/step_methods/compound.py:103:0-238:56) (defaults to None -> 1000).

  • Set default_tune_steps = 0 for [CategoricalGibbsMetropolis]
    (cci:2://file:///c:/Users/jayan/Desktop/pymc/pymc/step_methods/metropolis.py:687:0-865:38) and BinaryGibbsMetropolis.

  • Updated pm.sample to resolve tune=None by checking the step methods.
    I verified this with new unit tests and by confirming that CategoryGibbsMetropolis now produces traces with 0 warmup steps by default. @ricardoV94 this is ready for your review.

Related Issue:

markdown

markdown

  • Checked that the pre-commit linting/style checks pass
  • Included tests that prove the fix is effective or that the new feature works
  • Added necessary documentation (docstrings and example notebooks)

@Jayant-kernel
Copy link
Author

@ricardoV94 @aloctavodia
Thanks! I've opened a PR for this here: #8110.

The implementation allows steps to declare their own tuning needs (e.g., Gibbs tune=0) and falls back to the default otherwise.
Ready for your thoughts whenever you have a moment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow steps to decide number of tune

1 participant