Warn users when simulating campaigns without an objective#750
Warn users when simulating campaigns without an objective#750
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes issue #749 by enabling simulate_scenarios to work with campaigns that don't have an objective (e.g., campaigns using RandomRecommender). The fix automatically propagates an objective from the first campaign that has one to any campaigns lacking an objective, allowing target tracking during simulation.
Changes:
- Modified
simulate_scenariosto propagate objectives from campaigns that have them to campaigns that don't - Added comprehensive tests for both successful objective propagation and failure when no objective exists
- Updated CHANGELOG to document the fix
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| baybe/simulation/scenarios.py | Added objective propagation logic using attrs.evolve() and updated docstring to document the new behavior |
| tests/test_simulation.py | Added two tests: one for successful simulation with mixed objective/no-objective campaigns, and one to verify proper error handling when all campaigns lack objectives. Also updated import from baybe.targets.numerical to baybe.targets |
| CHANGELOG.md | Documented the fix in the "Fixed" section |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
objective in simulate_scenarios if campaign does not have onef6e8588 to
ccc494b
Compare
ccc494b to
d441747
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
| return pd.concat(dfs, ignore_index=True) | ||
|
|
||
| # Warn about campaigns without objectives | ||
| _no_obj_keys = [ |
There was a problem hiding this comment.
i think the warning should be thrown in simulate_experiment where the original error was thrown. This place here can catch and count them and rethrow a combined warning
Fixes #749 by warning users that there are campaign without an objective instead of crashing.
simulate_scenarioswill now run for the case described above, but warn the users about the missing objective(s). The code from the original bug now produces the following warningand the following result dataframe:
When also using a campaign that actually has an objective, the resulting dataframe looks as follows: