-
Notifications
You must be signed in to change notification settings - Fork 49
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
Botorch with cardinality constraint via sampling #301
base: main
Are you sure you want to change the base?
Botorch with cardinality constraint via sampling #301
Conversation
0be3285
to
1f7783d
Compare
1f7783d
to
9d28b49
Compare
f68ce4f
to
fc52875
Compare
This reverts commit daa594a.
@Scienfitz, this beast is finally ready for ready for review. Let's try to really merge it in this time. As already mentioned, the entire PR would be significantly smaller had we omitted the (potentially use case irrelevant?) option of setting a Happy to see your feedback |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
massive PR is massive
|
||
# Count the number of active values per dataframe row | ||
cols = df[c.parameters] | ||
is_inactive = is_between(cols, thresholds) | (cols == 0.0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isnt the cols == 0.0
part of obsolete? its also checked by is_between
since 0 is enforced to be inside the interval?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, not quite. There is a subtle issue because is_between
gives False
when the value is 0 and one of the bounds itself is zero (due to inequality check). Alternatively, we could resolve this by making is_between
a true generalization of pandas.Series.is_between
, which gives control on whether equality or inequality should be used. What do you prefer?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that would mak sene to me and would be prefereable, the current line here feels weird
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah no, my bad. The generalization does actually not solve the situation here. The special case was added for a different reason, namely to satisfy what is explained in the docstring of the cardinality constraint:
So is_between
really needs to be invoked with <
instead of <=
to correctly count inactive parameters. Can you confirm that I'm not talking BS, @Waschenbacher?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Synced with @AdrianSosic. We decide to rework on this part that should solve this issue as well as the other open thread here.
Co-authored-by: Martin Fitzner <17951239+Scienfitz@users.noreply.github.com>
Co-authored-by: Martin Fitzner <17951239+Scienfitz@users.noreply.github.com>
Co-authored-by: Martin Fitzner <17951239+Scienfitz@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Besides the open comments I have nothing else other than the usual please add something to the userguides for both discrete and conti cardinality constraints
(edited by @AdrianSosic)
This PR adds support for cardinality constraints to
BotorchRecommender
. The core idea is to tackle the problem in an exhaustive search like manner, i.e. byThe PR implements two mechanisms for determining the configuration of inactive parameters:
The current aggregation step is to simply optimize all subspaces independently of each other and then return the batch from the subspace where the highest acquisition value is achieved. This has the side-effect that the set of inactive parameters is the same across the entire recommendation batch. This can be a desirable property in many use cases but potentially higher acquisition values can be obtained by altering the in-/activity sets across the batch. A simple way to achieve this (though out of scope for this PR) is by generalizing the sequential greedy principle to multiple subspaces.
Out of scope