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

Simplify and extend meta recommender logic #457

Merged
merged 34 commits into from
Jan 22, 2025
Merged

Conversation

AdrianSosic
Copy link
Collaborator

@AdrianSosic AdrianSosic commented Jan 10, 2025

This PR refines the semantics of Meta recommenders and extends their use. It was motivated by two problems:

The important things changed:

  • MetaRecommenders now have a much simpler logic, i.e. they only contain a select_recommender, which always just returns the recommender appropriate for the context of the call. Previous statefulness, which was only relevant to sequential recommenders, has been moved to the corresponding classes.
  • They now have an is_stateful Boolean property
  • They now have an get_non_meta_recommender method for extracting the appropriate context-specific non-meta recommender from the hierarchy
  • They can now be composed of arbitrary other meta recommenders. The previous restriction that they need to be composed of pure recommenders was an unnecessary limitation. Allowing other meta recommenders as building blocks can indeed be indeed useful, for example, using a two-phase recommender where the second phase uses an adaptive (e.g. batch-size dependent) meta recommender.
  • Added the new BatchSizeAdaptiveMetaRecommender, which can be useful, e.g. to avoid too costly optimizations for large batch sizes.
  • TwoPhaseMetaRecommender now has an explicit remain_switch option to clarify its behavior.

@AdrianSosic AdrianSosic added enhancement Expand / change existing functionality refactor labels Jan 10, 2025
@AdrianSosic AdrianSosic self-assigned this Jan 10, 2025
@AdrianSosic AdrianSosic marked this pull request as ready for review January 10, 2025 14:33
@AdrianSosic AdrianSosic marked this pull request as draft January 10, 2025 14:34
@AdrianSosic AdrianSosic marked this pull request as ready for review January 10, 2025 14:45
@AdrianSosic
Copy link
Collaborator Author

@AVHopp @Scienfitz
Note, I've just added one more commit introducing a get_inner_recommender method, which is useful for #423.

Copy link
Collaborator

@AVHopp AVHopp left a comment

Choose a reason for hiding this comment

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

Incomplete review since there was another issues that required my attention, but still a first bunch of comments.

CHANGELOG.md Outdated Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
baybe/recommenders/meta/base.py Outdated Show resolved Hide resolved
baybe/recommenders/meta/sequential.py Outdated Show resolved Hide resolved
baybe/recommenders/meta/sequential.py Show resolved Hide resolved
baybe/recommenders/meta/sequential.py Outdated Show resolved Hide resolved
baybe/recommenders/meta/sequential.py Show resolved Hide resolved
baybe/recommenders/meta/sequential.py Show resolved Hide resolved
baybe/recommenders/meta/sequential.py Show resolved Hide resolved
baybe/recommenders/meta/sequential.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@AVHopp AVHopp left a comment

Choose a reason for hiding this comment

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

Last bit of my review that was still missing.

baybe/recommenders/meta/adaptive.py Outdated Show resolved Hide resolved
baybe/recommenders/meta/adaptive.py Outdated Show resolved Hide resolved
baybe/recommenders/meta/base.py Show resolved Hide resolved
baybe/recommenders/meta/sequential.py Outdated Show resolved Hide resolved
baybe/recommenders/meta/sequential.py Show resolved Hide resolved
baybe/recommenders/meta/adaptive.py Outdated Show resolved Hide resolved
baybe/recommenders/meta/base.py Outdated Show resolved Hide resolved
baybe/campaign.py Outdated Show resolved Hide resolved
baybe/recommenders/meta/sequential.py Outdated Show resolved Hide resolved
baybe/recommenders/meta/sequential.py Show resolved Hide resolved
baybe/recommenders/meta/sequential.py Show resolved Hide resolved
@AdrianSosic AdrianSosic merged commit af3f86b into main Jan 22, 2025
9 of 11 checks passed
@AdrianSosic AdrianSosic deleted the fix/meta_recommender branch January 22, 2025 10:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Expand / change existing functionality refactor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unintuitive switching behavior of Meta-Recommenders in combination with Campaign
3 participants