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

Monte Carlo acquisition functions #48

Merged
merged 11 commits into from
Oct 24, 2023
Merged

Conversation

thomaswmorris
Copy link
Collaborator

This PR adds more Monte Carlo acquisition functions, which should be preferred to analytic ones (as they are faster to optimize and more robust).

@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@thomaswmorris
Copy link
Collaborator Author

The learn method does the same thing as the initialize method, so it makes sense to combine them and just warn the user that they have to start with a quasi-random acquisition function.

Copy link
Member

@mrakitin mrakitin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good improvement overall. I have a few suggestions below to document the code better and have better test coverage.

bloptools/bayesian/acquisition/__init__.py Show resolved Hide resolved
def probabilities(self, x, n_samples=256):
def probabilities(self, x, n_samples=1024):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What caused the default to change?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, this should probably be lower. It samples a Dirichlet distribution n_samples times in constructing the classification model.

bloptools/bayesian/__init__.py Show resolved Hide resolved
bloptools/bayesian/acquisition/__init__.py Show resolved Hide resolved
bloptools/bayesian/acquisition/__init__.py Show resolved Hide resolved
monte_carlo_upper_confidence_bound:
default_args:
beta: 4
description: The expected value, plus some multiple of the uncertainty (typically \mu + 2\sigma).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Describe the MC effect/benefit here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should I explain it here? It applies to all the MC acquisition functions (which is that it run faster, more robust and can run in parallel), which we should definitely put somewhere.

bloptools/bayesian/__init__.py Show resolved Hide resolved
Comment on lines +261 to +262
acq_func_identifier: which acquisition function to use
n: how many points to get
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll put numpydoc docstrings on all the agent methods in the next PR

bloptools/tests/test_acq_funcs.py Show resolved Hide resolved
bloptools/bayesian/__init__.py Show resolved Hide resolved
@mrakitin mrakitin mentioned this pull request Oct 24, 2023
2 tasks
Copy link
Member

@mrakitin mrakitin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! The docs updates will be covered by #50.

@mrakitin mrakitin merged commit b9e3db0 into NSLS-II:main Oct 24, 2023
5 checks passed
@thomaswmorris thomaswmorris deleted the monte-carlo branch November 4, 2023 14:32
thomaswmorris pushed a commit to thomaswmorris/blop that referenced this pull request Jul 15, 2024
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.

3 participants