emdgroup / baybe

Bayesian Optimization and Design of Experiments
https://emdgroup.github.io/baybe/
Apache License 2.0
247 stars 39 forks source link

Posterior-compatible target transformations #373

Open AdrianSosic opened 1 week ago

AdrianSosic commented 1 week ago

Currently, getting access the posterior distribution when transformed targets are involved is not possible (e.g. for DesirabilityObjective or even SingleTargetObjective when the target itself has a transformation).

The problem causing the issue is that we apply these transformations on the target values first and only then build the model on the transformed values. Logically, that is exactly the same issue already solved in https://github.com/emdgroup/baybe/pull/340 for the "MIN" transform.

And the solution is also the same: Instead of building the model on the transformed targets and then running into problems of not being able to invert the transformation (like with "BELL"), we should simply by default build the model on the actual targets and then transform the obtained posterior. That is, for example, the desirability averaging would happen at a later stage using botorch's transforms. Plus it comes with the benefit that we can offer surrogates for both the raw targets as well as derived values. So in future we can make the DesirabilityObjective return N surrogates for the N targets involved plus an N+1 surrogate modeling the desirability posterior values. Similarly, for the upcoming ParetoObjective.

Scienfitz commented 1 week ago

This will not only be useful for SHAP analysis but also for target constraints. The latter would not be available for specific targets if they are part of a desirability object

However, theres also this aspect. Modelling the desirability according to this is not equivalent to the implemented approach because it fits separate models. Purely for computational reason it could still be wanted to create the desirability according to the implemented approach. So essentially I would say that the implementation you suggest for desirability should become its own Objective, e.g. PosteriorTransformedDesirabilityObjective or any better name we can come up with

Additionally, the approach you suggest might not always be possible, e.g. for more complex scalarization techniques such as CHIMERA