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

Comp Rep Transition Point #278

Merged
merged 8 commits into from
Jul 3, 2024

Conversation

AdrianSosic
Copy link
Collaborator

@AdrianSosic AdrianSosic commented Jun 25, 2024

This PR is a first step toward a refactored Surrogate layout:

  • It moves the exp_rep-to-comp_rep transition point into the surrogates, which now become responsible for handling the transformation and can do it in whatever way they need it (which will also simplify scaling later on).
  • This cleans up the interface because users / calling classes can now pass data in its canonical form (i.e., exp_rep) and do not need to worry about transformations.
  • This also means we can easily expose the trained surrogates to users for model inspection (e.g., feature importance).

CHANGELOG.md Outdated Show resolved Hide resolved
baybe/acquisition/base.py Show resolved Hide resolved
@AdrianSosic AdrianSosic force-pushed the refactor/surrogates/transition_point branch from ed2a23b to f2f5370 Compare June 25, 2024 15:51
@Scienfitz
Copy link
Collaborator

@AdrianSosic I guess you shouldnt rebase this branch but the target branch? otherwise i see the last main commits also always in this PR :/

CHANGELOG.md Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
baybe/acquisition/base.py Show resolved Hide resolved
baybe/acquisition/base.py Show resolved Hide resolved
baybe/exceptions.py Outdated Show resolved Hide resolved
baybe/acquisition/base.py Outdated Show resolved Hide resolved
baybe/surrogates/utils.py Show resolved Hide resolved
@AdrianSosic AdrianSosic force-pushed the refactor/surrogates/transition_point branch 2 times, most recently from 041dbd6 to 33ac341 Compare June 26, 2024 12:31
@AdrianSosic AdrianSosic force-pushed the refactor/surrogates/transition_point branch from 33ac341 to 49350a3 Compare June 26, 2024 14:27
@AdrianSosic AdrianSosic reopened this Jun 26, 2024
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.

This is an incomplete PR, but I am currently trying to figure out how to do these more efficiently. More will come :D

baybe/acquisition/base.py Outdated Show resolved Hide resolved
baybe/searchspace/core.py Outdated Show resolved Hide resolved
baybe/searchspace/core.py Outdated Show resolved Hide resolved
baybe/searchspace/discrete.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.

Next round of comments, looking good overall imo

baybe/exceptions.py Show resolved Hide resolved
baybe/searchspace/core.py Outdated Show resolved Hide resolved
baybe/surrogates/base.py Outdated Show resolved Hide resolved
baybe/surrogates/base.py Show resolved Hide resolved
baybe/surrogates/base.py Show resolved Hide resolved
baybe/surrogates/base.py Show resolved Hide resolved
baybe/recommenders/pure/nonpredictive/clustering.py Outdated Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
baybe/searchspace/discrete.py Outdated Show resolved Hide resolved
@Scienfitz
Copy link
Collaborator

will wait with approval for other PR and rebase

@AdrianSosic AdrianSosic force-pushed the refactor/surrogates/transition_point branch 4 times, most recently from 0dec698 to 7669528 Compare July 1, 2024 19:27
@AdrianSosic AdrianSosic force-pushed the refactor/surrogates/transition_point branch from 7669528 to 78e3938 Compare July 3, 2024 09:05
@AdrianSosic AdrianSosic merged commit f1406ae into dev/surrogates Jul 3, 2024
6 of 10 checks passed
@AdrianSosic AdrianSosic deleted the refactor/surrogates/transition_point branch July 3, 2024 09:27
@AdrianSosic AdrianSosic added this to the Surrogate refactoring milestone Jul 24, 2024
@AdrianSosic AdrianSosic mentioned this pull request Aug 9, 2024
AdrianSosic added a commit that referenced this pull request Aug 29, 2024
Completes the surrogate factoring, which extended over #278, #309, #315,
#325, #337.

### Most important changes
* The transition point from experimental to computational representation
has been moved from the recommender to the surrogate. From an
architecture/responsibility perspective, this is reasonable since the
recommend should not have to bother about algorithmic/computational
details.
* The desired consequence is that public `Surrogate` methods like
`posterior` and `fit` can now operate on dataframes in experimental
representation, meaning they can also be exposed directly to the user.
* The new posterior methods now all return a general `Posterior` object
instead of implicitly assuming Gaussian distributions. This paves the
way for arbitrary surrogate extensions, such as Bernoulli/Categorical
surrogates, etc. At the moment, this introduces an explicit coupling to
botorch, which is fine because botorch remains a core dependency and the
only backend used for complex surrogate modeling. In the future, this
can be further abstracted by introducing our own `Posterior` class.
* The `Surrogate` layout has been refined such that the extracted
`SurrogateProtocol`, which now defines the formal interface for all
surrogates, imposes minimal requirements to the user.
* Scaling has been completely redesigned, offering the possibility to
configure input/output scaling down to the level of individual
parameters and targets. The configuration is currently class-specific,
but can be extended to allow surrogate instance specific rules in the
future.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants