Skip to content

Preserve exploration decay progress when loading optimizer state - #631

Open
AryanRG wants to merge 1 commit into
bayesian-optimization:masterfrom
AryanRG:fix/restore-exploration-decay-progress
Open

AryanRG wants to merge 1 commit into
bayesian-optimization:masterfrom
AryanRG:fix/restore-exploration-decay-progress

Conversation

@AryanRG

@AryanRG AryanRG commented Oct 23, 2026 •

Copy link
Copy Markdown

Loading saved optimizer state resets the acquisition function's suggestion counter. With exploration_decay_delay, this delays exploration decay again instead of continuing the saved schedule.

Save and restore the counter for UCB, PI and EI, while keeping older checkpoints without that field loadable. Add save/load regressions before and after the delay, with controls for no delay and legacy state.

Validation: the Python test suite excluding notebook execution, Ruff lint and formatting pass. Notebook tests were not run.

Prepared with AI assistance.

Summary by CodeRabbit

  • Bug Fixes
    • Restoring saved acquisition settings now preserves the suggestion count, allowing exploration schedules to continue from where they left off.
    • Older saved settings without a suggestion count retain the current count when restored.
  • Tests
    • Added coverage for saving and restoring exploration schedules across acquisition methods, including compatibility with older saved settings.

@coderabbitai

coderabbitai Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 4de96106-7d07-4b4c-aed2-a83f81645a49
📥 Commits

Reviewing files that changed from the base of the PR and between ec45123 and 6be9a04.

📒 Files selected for processing: 2
  • bayes_opt/acquisition.py
  • tests/test_acquisition_state.py

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.

📝 Walkthrough

UCB, POI, and EI now include their suggestion counter in saved acquisition parameters and restore it when present. Tests cover restoring schedules and loading legacy states without the counter.

Changes: Acquisition state persistence

Layer / File(s) Summary
Persist and restore suggestion counters
bayes_opt/acquisition.py, tests/test_acquisition_state.py
UCB, POI, and EI save and restore the suggestion counter. Tests compare restored parameters and suggestions, including when the saved state does not contain the counter.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested reviewers: phi-friday

Merge Risk: ⚪ Minimal · up to 6be9a

The saved exploration schedule appears to resume as intended. No actionable merge-blocking issue remains after normal checks.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 9 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: preserving exploration decay progress when loading optimizer state.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Oct 23, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.28%. Comparing base (ec45123) to head (6be9a04).

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #631   +/-   ##
=======================================
  Coverage   98.27%   98.28%           
=======================================
  Files          10       10           
  Lines        1220     1223    +3     
=======================================
+ Hits         1199     1202    +3     
  Misses         21       21           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant