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

Remove correlation between the step size and the step direction (#2156) #2290

Closed
wants to merge 4 commits into from

Conversation

zankin
Copy link
Contributor

@zankin zankin commented Apr 9, 2024

Motivation

This is a quick fix of #2156.

In the botorch.utils.sampling.sample_polytope(), both the step size rands and direction Rs are currently sampled using the same seed value. This can lead to strong correlation and induce sampling bias, particularly with a small number of steps (e.g., n=1), as illustrated in #2156. Adding +1 to the seed value for Rs helps to avoid such behaviour.

Have you read the Contributing Guidelines on pull requests?

Yes.

Test Plan

Not sure if any unit tests needed for that change.

@facebook-github-bot facebook-github-bot added the CLA Signed Do not delete this pull request or issue due to inactivity. label Apr 9, 2024
@@ -250,7 +250,7 @@ def sample_polytope(
d = x0.size(0)
# uniform samples from unit ball in d dims
Rs = sample_hypersphere(
d=d, n=n_tot, dtype=A.dtype, device=A.device, seed=seed
d=d, n=n_tot, dtype=A.dtype, device=A.device, seed=seed + 1
Copy link
Contributor

Choose a reason for hiding this comment

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

Would you mind adding a brief comment for why this is necessary, that links to #2156 please?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done. Hope it is clearer now 🙂

@sdaulton
Copy link
Contributor

Thanks for the PR! It looks good, but it would be great to add a comment on why this needed in line, for posterity.

@zankin zankin requested a review from sdaulton April 26, 2024 14:59
@Balandat
Copy link
Contributor

Sorry for the delay @zankin, sdaulton has been out. Could you add the link to the issue as per my suggestion? Then I'm happy to merge this in.

@zankin
Copy link
Contributor Author

zankin commented May 9, 2024

Sorry for the delay @zankin, sdaulton has been out. Could you add the link to the issue as per my suggestion? Then I'm happy to merge this in.

Thanks! I've included a link to the issue in the comment line.

@facebook-github-bot
Copy link
Contributor

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

Copy link

codecov bot commented May 10, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.97%. Comparing base (dc219ca) to head (3486890).
Report is 29 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff            @@
##             main    #2290    +/-   ##
========================================
  Coverage   99.97%   99.97%            
========================================
  Files         197      189     -8     
  Lines       17165    16669   -496     
========================================
- Hits        17160    16665   -495     
+ Misses          5        4     -1     

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

@facebook-github-bot
Copy link
Contributor

@Balandat merged this pull request in 5c8b8ae.

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.

4 participants