Adding fixed_paramter to ContinuousInput#760
Conversation
|
Hi @KislayaRavi, thanks for the PR. I am a bit hesitant to change this as we rely in a lot of APIs in production on handling this, for this reason I would like to understand the problem a bit better:
Best, Johannes cc: @bertiqwerty |
|
I just feel that current setup is non-intuitive and it overcomplicates everything else. At this moment, it is not a make or break pull request, just a good to have feature. I have also jumped few hoops for the fixed parameters in my setup by storing the bounds separately in a variable (user provided bounds and surrogate bounds are different things) and using them later for other things instead of directly calling the bounds from the strategy/domain object generated from Bofire. But, this change might help in future when we need to send additional payload to other API instead of just sending serialised data models. It might turn the setup more intuitive and less prone to error. I understand your issue of API in production use case. I had same headache (still having) when all the Scalers were removed and allow_zero was added. That's why we also need a way to futurize data models when we update bofire versions, which leads to one of your old pull request. Let us discuss this together in hackathon. |
|
Sounds good to discuss on the hackathon, also have a look at this almost finished PR where a lot was implemented regarding |
Motivation
In this pull request, I am targeting optimization problems where we want to hold one or more continuous parameters constant during optimization while still including them as inputs to the surrogate model. Previously, the only way to achieve this in BoFire was to set
lower_bound == upper_bound, which collapses the parameter's range to a single point. This is non-intuitive for two reasons:(1) it destroys the meaningful range of the parameter, making it impossible to express the true experimental bounds; and
(2) it conflates two distinct concepts — a parameter that is physically constrained to one value versus one that is deliberately fixed for a particular optimization run.
This PR introduces an explicit
fixed_value: Optional[float] = Nonefield onContinuousInput. When set, the parameter is pinned to that value during acquisition function optimization (via BoTorch's fixed_features mechanism), while its bounds remain intact for surrogate training. Training data may contain any value within[lower, upper]for the parameter, allowing historical experiments — collected before the parameter was frozen — to inform the surrogate model. The existinglower == upper convention is fully preserved for backward compatibility. The method previously namedfixed_value()across the input feature hierarchy has been renamed toget_fixed_value()to avoid a name collision with the new Pydantic field.Have you read the Contributing Guidelines on pull requests?
yes
Have you updated
CHANGELOG.md?yes
Test Plan