Skip to content

[GENERAL SUPPORT]: Hooking up custom BoTorch acquisition functions #3288

Open
@parrangoiz

Description

Question

Hello, general question here. I'm working on hooking up the ECI acquisition function from the BoTorch tutorials to the Ax machinery. ECI is not part of the official BoTorch library as far as I can tell and only exists as an example/tutorial, but even that demo implementation there seems to do a good job at solving the problem I am working on. So now I want to hook it up to Ax for easier data management, saving experiments, etc. I've gone through all the required steps (mainly defining an input constructor) and have run into a couple speed bumps along the way:

  1. The Ax Acquisition wrapper class attempts to inject many arguments (see here) which may or may not be input arguments to the custom BoTorch acquisition class we're trying to plug into. For instance, in this case a posterior_transform argument is passed, so I ended up having to add it as well to the ECI implementation even though it is not used for anything. If I don't add it, the decorated input constructor, which gets preprocessed by allow_only_specific_variable_kwargs, throws an error.
  2. The Acquisition constructor preprocesses the outcome constraints in the TorchOptConfig container into a list of Callables. It seems that many BoTorch acquisition functions (e.g. most of the ones in botorch.acquisition.monte_carlo) take in outcome constraints in this form, but others don't (e.g. some of the analytic functions that support constraints). The toy implementation of ECI assumed a different constraint format, but in this case it's simple enough for me to modify the implementation to work with callables instead.

In sum, so far it looks like I am managing to establish the connection, albeit in a somewhat hacky way. Thoughts? Am I on the right track? More generally I get the feeling that Ax's Acquisition already makes too many assumptions and therefore subclassing it to specialize it to custom backend implementations is not a good approach, and one has to resort to hacking a bit. I saw some discussion in past issues regarding this problem and the need to refactor the API so maybe that's a good long-ish term project to increase flexibility. For now, I am happy to (eventually) put in a BoTorch MR to make ECI part of the official library if there is interest in this and once I get some pointers/feedback on my approach.

Please provide any relevant code snippet if applicable.

Code of Conduct

  • I agree to follow this Ax's Code of Conduct

Metadata

Assignees

Labels

questionFurther information is requested

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions