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

Homotopy explicit all kwargs #2588

Closed

Conversation

CompRhys
Copy link
Contributor

@CompRhys CompRhys commented Oct 21, 2024

This PR seeks to address: #2579

optimize_acqf_homotopy is a fairly minimal wrapper around optimize_acqf but didn't have all the constraint functionality.

This PR copies over all of the arguments that we could in principal want to use up into optimize_acqf_homotopy. For the time being final_options has been kept. The apparent bug with fixed features not being passed to the final optimization has been fixed.

a simple dict rather than OptimizeAcqfInputs dataclass is used to store the shared parameters.

Related PRs

The original approach in #2580 made use of kwargs which was opposed due to being less explicit.

@facebook-github-bot facebook-github-bot added the CLA Signed Do not delete this pull request or issue due to inactivity. label Oct 21, 2024
Copy link
Contributor

@saitcakmak saitcakmak left a comment

Choose a reason for hiding this comment

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

Thanks for the update! This is much more in-line with the rest of the optimize_acqf signatures.

Comment on lines 16 to 21
from collections.abc import Callable

from botorch.generation.gen import TGenCandidates
from botorch.optim.initializers import (
TGenInitialConditions,
)
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you run ufmt format . on the PR? This will fail the linter.

Copy link
Contributor Author

@CompRhys CompRhys Oct 21, 2024

Choose a reason for hiding this comment

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

Sure, Can I add a pre-commit yaml to have this be an auto hook? doesn't work out of the box with ufmt

Copy link

codecov bot commented Oct 21, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.98%. Comparing base (ca956e1) to head (2761d54).
Report is 8 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2588   +/-   ##
=======================================
  Coverage   99.98%   99.98%           
=======================================
  Files         196      196           
  Lines       17333    17345   +12     
=======================================
+ Hits        17330    17343   +13     
+ Misses          3        2    -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@facebook-github-bot
Copy link
Contributor

@saitcakmak has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@facebook-github-bot
Copy link
Contributor

@saitcakmak has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

inequality_constraints=constraints,
)
self.assertEqual(candidate.shape, torch.Size([1, 2]))
self.assertGreaterEqual(candidate.sum(), 2.0)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
self.assertGreaterEqual(candidate.sum(), 2.0)
self.assertGreaterEqual(candidate.sum().item(), 2.0)

Copy link
Contributor

Choose a reason for hiding this comment

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

Weird that this is failing. I was gonna try comparing floats but looks like I don't have commit access to the PR

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If I make this change it at least makes the failure explict:

FAILED test/optim/test_homotopy.py::TestHomotopy::test_optimize_acqf_homotopy - AssertionError: 1.999999999999982 not greater than or equal to 2.0

Would you be okay if I change the test to >= 2.0 - 1e-6?

Copy link
Contributor

Choose a reason for hiding this comment

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

That sounds reasonable to me

@CompRhys
Copy link
Contributor Author

Can we hold off merging this as I signed the CLA for a previous commit in my personal time and someone at my new company wants the lawyer to check

@saitcakmak
Copy link
Contributor

Sure, let us know when it is safe to merge.

@CompRhys
Copy link
Contributor Author

we're good to go

@facebook-github-bot
Copy link
Contributor

@saitcakmak has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@facebook-github-bot
Copy link
Contributor

@saitcakmak merged this pull request in 24f659c.

@CompRhys CompRhys deleted the homotopy-explicit-all-kwargs branch October 22, 2024 20:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed Do not delete this pull request or issue due to inactivity. Merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants