Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add jitter_scale parameter for initial point generation #7643

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

aphc14
Copy link

@aphc14 aphc14 commented Jan 13, 2025

Description

Add jitter_scale parameter to control the bounds of uniform jitter in initial points. This allows users to adjust the width of random initialisation, which is useful for the Multi-path Pathfinder algorithm to explore posteriors in a larger parameter space or where the posterior mean is much further away from the prior mean.

Changes:

  • Add jitter_scale parameter (default=1.0) to initial point functions
  • Update jitter bounds from U(-1,1) to U(-jitter_scale, jitter_scale)
  • Add test_jitter_scale to verify scaling behaviour
  • Update docstrings to reflect new parameter

Related Issue

Checklist

Type of change

  • New feature / enhancement
  • Bug fix
  • Documentation
  • Maintenance
  • Other (please specify):

📚 Documentation preview 📚: https://pymc--7643.org.readthedocs.build/en/7643/

Copy link

welcome bot commented Jan 13, 2025

Thank You Banner]
💖 Thanks for opening this pull request! 💖 The PyMC community really appreciates your time and effort to contribute to the project. Please make sure you have read our Contributing Guidelines and filled in our pull request template to the best of your ability.

@@ -66,6 +66,7 @@ def make_initial_point_fns_per_chain(
model,
overrides: StartDict | Sequence[StartDict | None] | None,
jitter_rvs: set[TensorVariable] | None = None,
jitter_scale: float = 1.0,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to update the docstrings of the function that now accept jitter_scale

@ricardoV94 ricardoV94 changed the title ENH: Add jitter_scale parameter for initial point generation (#7555) Add jitter_scale parameter for initial point generation Jan 15, 2025
@@ -1453,6 +1456,7 @@ def _init_jitter(
model=model,
overrides=initvals,
jitter_rvs=set(model.free_RVs) if jitter else set(),
jitter_scale=jitter_scale if jitter else 1.0,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it's required in this inner function, there's no need for the if/else?

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

Successfully merging this pull request may close these issues.

ENH: Option to adjust the uniform distribution bounds for jitter/initialisation
2 participants