Acquisition Function Handling & Related Improvements#99
Closed
tautomer wants to merge 22 commits into
Closed
Conversation
Main changes in RNG: 1. Introduced GlobalRNG class for centralized RNG control 2. Replaced all instances of torch random number generation now with a generator 3. Replaced all instances of numpy.random with a generator 4. Introduced a with_tmp_seed context manager for all hidden/implicit random number generation 5. Introduced a package level toggle USE_OLD_RNG_CONTROL for backward compatibility Misc fixes/improvements 1. Introduced direct optimizer options passthrough to model fitting routine in campaign.fit 2. Introduced direct optimizer options passthrough to acquisition function optimization in optimizer.suggest 3. Vectorized the noise generation in simulator 4. Some code style cleanups and type hint fixes around RNG-related blocks
1. Fix a regression from merging 2. Fix a bug where optimize_acqf get an input of fixed_features_list
1. Allow externally defined noise functions (can be related to X) 2. Make the Optithon benchmark function compatible with the Simulator
While dictionaries work, a more structured approach using classes could improve maintainability and clarity. Hereby, we introduce the following changes 1. `AcquisitionConfig` which handles the configuration of acquisition functions, including their hyperparameters and parsing logic. 2. `AcquisitionRegistry` which is a centralized registry for all internal and possibly external acquisition functions. Hyperparameters validation and parsing logic are also managed within this class. 3. config.py, now as its name suggests, focuses on the "configurations". 4. Backward compatibility is maintained by exporting the necessary properties from the registry. In the future, the Bayesian optimizer class will be updated to directly interact with the registry instead.
1. Drop the global RNG manager enforcement. 2. New default behavior: each Campaign creates its own RNG manager. This also paves the way for future dash app refactoring. 3. For temporary random state override, the seed is generated at call time instead of decorator definition time by default. This change leads to better reproducibility. 4. For numerical reproducbility, optimizer by default uses a fixed random state when every time fit or suggest is called. 5. Fix optimizer save and load state.
- Add acquisition function registry infrastructure - Migrate bayesian.py to use registry for acquisition instantiation and add helper methods, _build_parser_context, _setup_model_and_objective, _setup_constraints - Add ParserContext type for acquisition function hyperparameter parsing - Add TaskType enum for optimization/characterization task types - Refactor suggest() and evaluate() methods to reduce code duplication - Add external acquisition function support via registry
- Always use RNG manager's seed if not set in campaign and optimizer - Override seeds in test files when loading from legacy state dict
- Add dummy parsers for acquisition functions that do not need hyperparameter parsing - Always remove objective for NIPV - Fix RandomSampling (missing super init)
- Prevent FlatGP from failing some tests due to non-PSD issues with double precision - Add global test configuration enforcing double precision for all tests
This commit adds support for saving the state of unfitted optimizers, which can be useful for many cases. Backward compatibility with old saves is maintained.
- Allow users to specify targets that are "tracking-only", meaning they are not optimized towards by default, but can be included in the optimization process if explicitly requested. While this was possible via passing a `target` to suggest, this change make it easier to set up a campaign with mixed targets. - Add support from save/load states and tests related to this change.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refactors acquisition function management in the Bayesian optimizer to use a structured registry pattern, adds support for tracking-only targets, and includes several bug fixes.
This PR is built upon #81 and some other smaller fixes.
Key Changes
Acquisition Function Refactor
Tracking-Only Targets
Optimizer State