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

Sample to the bounds in quasi random optimizers #598

Merged
merged 6 commits into from
Mar 31, 2020
Merged

Sample to the bounds in quasi random optimizers #598

merged 6 commits into from
Mar 31, 2020

Conversation

jrapin
Copy link
Contributor

@jrapin jrapin commented Mar 30, 2020

Types of changes

  • Docs change / refactoring / dependency upgrade
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Motivation and Context / Related issue

Ugly patch for #515
Better methods should be implemented at some point :s

How Has This Been Tested (if it applies)

Checklist

  • The documentation is up-to-date with the changes I made.
  • I have read the CONTRIBUTING document and completed the CLA (see CONTRIBUTING).
  • All tests passed, and additional code has been covered with new tests.

@jrapin jrapin changed the title Prepare bound checker Fix bound transform for quasi random optimizers Mar 30, 2020
@jrapin jrapin changed the title Fix bound transform for quasi random optimizers [WIP] Fix bound transform for quasi random optimizers Mar 30, 2020
@facebook-github-bot facebook-github-bot added the CLA Signed Do not delete this pull request or issue due to inactivity. label Mar 30, 2020
@jrapin
Copy link
Contributor Author

jrapin commented Mar 31, 2020

Illustrations are based on the following snippet:

import nevergrad as ng
import numpy as np
budget = 100
parametrization = ng.p.Tuple(*(ng.p.Scalar(lower=-12, upper=12) for _ in range(2)))
optimizer = ng.optimizers.LHSSearch(parametrization, budget=budget)
points = np.array([optimizer.ask().value for _ in range(budget)])
%matplotlib
import matplotlib.pyplot as plt
plt.plot(points[:, 0], points[:, 1], 'x')
plt.gca().set_xlim([-12, 12])
plt.gca().set_ylim([-12, 12])

With the current master, this provides:
Screen Shot 2020-03-31 at 9 30 29 AM

After this PR, this would sample as follows:
Screen Shot 2020-03-31 at 9 31 30 AM

With the following tag we can get mixed behavior (sampling on the full range on x, and according to the distribution on y:

parametrization[1].full_range_sampling = False

Screen Shot 2020-03-31 at 9 46 56 AM

@jrapin jrapin changed the title [WIP] Fix bound transform for quasi random optimizers Sample to the bounds in quasi random optimizers Mar 31, 2020
@jrapin jrapin requested a review from teytaud March 31, 2020 08:28
@jrapin jrapin self-assigned this Mar 31, 2020
@jrapin
Copy link
Contributor Author

jrapin commented Mar 31, 2020

discussed with @teytaud and accepted

@jrapin jrapin merged commit 5fa6e96 into master Mar 31, 2020
@jrapin jrapin deleted the bounds branch March 31, 2020 16:06
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. Difficulty: High Priority: High Type: Bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants