Skip to content
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

RandMaxVar update and batch acquisitions #478

Merged
merged 7 commits into from
Mar 22, 2024

Conversation

uremes
Copy link
Contributor

@uremes uremes commented Mar 13, 2024

Summary:

The randmaxvar acquisitions are sampled from the maxvar acquisition function with an MCMC sampler. Two updates are proposed here:

  1. add option to use prior distribution in sampler initialisation

The acquisition method needs to initialise the MCMC sampler with a point that has maxvar acquisition score (approximate posterior variance) above zero. The current version samples candidate points from a uniform distribution within BOLFI bounds. The updated version includes an option to sample from the prior distribution.

  1. batch acquisitions

The current implementation runs one MCMC chain and returns the batch_size last samples. This works when batch_size=1 but does not provide a representative sample from the maxvar acquisition function otherwise. The version proposed in this update returns the last mcmc sample when batch_size=1 and a random sample from the MCMC chain otherwise.

For illustration, here are batches acquired by running BOLFI on the MA2 example with log-discrepancies using batch_size=10 and the current randmaxvar implementation with sampler=’metropolis’ and n_samples=2000. The batches tend to include 2-4 unique parameter values:

image

These are batches acquired by running the same example using the updated implementation with the same parameters as above and warmup=500. Most batches now include 10 unique parameter values:

image

Please make sure

  • You have read contribution guidelines
  • You have updated CHANGELOG.rst
  • You have listed the copyright holder for the work you are submitting (see next section)

If your contribution adds, removes or somehow changes the functional behavior of the package, please check that

  • You have included or updated all the relevant documentation, including docstrings
  • You have added appropriate functional and unit tests to ensure the new features behave as expected
  • You have run make lint, make docs and make test

and the proposed changes pass all unit tests (check step 6 of CONTRIBUTING.rst for details)

Copyright and Licensing

Please list the copyright holder for the work you are submitting (this will be you or your assignee, such as a university or company):

By submitting this pull request, the copyright holder is agreeing to license the submitted work under the following licenses:

@uremes uremes requested a review from hpesonen March 14, 2024 00:14
@uremes
Copy link
Contributor Author

uremes commented Mar 14, 2024

addressed the feedback that users may not want the prior to be used in sampler initialisation. default option is now to use the uniform distribution, and the user needs to set init_from_prior=True to sample from the prior instead.

elfi/methods/bo/acquisition.py Show resolved Hide resolved
@hpesonen hpesonen merged commit 536dc8d into elfi-dev:dev Mar 22, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants