botorch icon indicating copy to clipboard operation
botorch copied to clipboard

Make FullyBayesian ABC more flexible again

Open CompRhys opened this issue 6 months ago • 3 comments

Motivation

In the old ABC we could pass an already initialized pyro_model which allowed for fairly complicated pyro_models to be used in the available framework. The refactor prevents us passing arbitary kwargs to the pyro_model and so is a step back in terms of hackability of the code.

Passing a dict of kwargs seems like the right way to keep things flexible if no longer able to just pass the model. This PR is just a draft as I am not sure yet what else I need to touch.

Have you read the [Contributing Guidelines on pull requests]

Yes

Test Plan

Ensure tests pass, add new tests if needed.

Related PRs

None

CompRhys avatar Jun 09 '25 15:06 CompRhys

cc @sdaulton

Balandat avatar Jun 12 '25 07:06 Balandat

This makes sense to me. An alternative to passing pyro_model_kwargs would be to specify the specific args that you'd like to pass, to allow for stricter input checking. What kwargs were you interesting in passing?

sdaulton avatar Jun 24 '25 14:06 sdaulton

I am passing in a small neural network to have a fully bayesian deep kernel model and then I hijack the training function to train it. Hence why having the greater flexibility was good

CompRhys avatar Jun 24 '25 19:06 CompRhys

@sdaulton what would you suggest are the next steps here? are you happy with the catch-all kwargs and I should work on fixing the tests?

CompRhys avatar Jul 10 '25 14:07 CompRhys

Just wanted to add that this would be very useful for me! I am intending to use a tree-based GP kernel which we sample with MCMC, which I will convert to a Pyro model, then use as in a FullyBayesian BoTorch model.

TobyBoyne avatar Aug 07 '25 15:08 TobyBoyne

Sorry for the delay here. I lost track of this issue. A couple thoughts:

  1. If we just pass pyro_model_kwargs,
  • Then we have little type-checking/validation of the arguments, which is something we aim to avoid in the codebase.
  • Then we are still restricted to the pyro_model_class of the specific subclass of AbstractFullyBayesianSingleTaskGP. This wouldn't be able to support something like a tree-based kernel without implementing a new subclass of AbstractFullyBayesianSingleTaskGP (and a new subclass of PyroModel).
  1. If we allow passing an instantiated pyro_model, then we'd want to add more subclasses of a base PyroModel in order to be able to better specify the types of PyroModels that are supported by each subclass of AbstractFullyBayesianSingleTaskGP. E.g. a SaasFullyBayesianSingleTaskGP requires an outputscale while a FullyBayesianSingleTaskGP does not allow one.

If one is implementing a custom PyroModel, is there any reason for them not to also implement a custom subclass of AbstractFullyBayesianSingleTaskGP? Curious what the best user experience would look like for using FullyBayesian models

sdaulton avatar Aug 26 '25 21:08 sdaulton