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

Support CMA-ES with margin in CmaEsSampler #4016

Merged
merged 18 commits into from
Nov 17, 2022
Merged

Conversation

knshnb
Copy link
Member

@knshnb knshnb commented Sep 26, 2022

Motivation

Support CMA-ES with margin, which lower-bounds the marginal probability associated with each discrete space so that samples can avoid being fixed to a single point.

In Optuna, IntDistribution and FloatDistribution with step can be regarded as discrete search spaces. I supported the combination with the source_trials argument, but currently, it cannot be used with use_separable_cma=True.

In the benchmarks of the HPO bench, it outperformed the original CMA-ES when the number of trials is large (200-400+) (link).

Description of the changes

  • Add with_margin argument to CmaEsSampler.
  • Use CMAwM class, which was released in v0.9.0 of cmaes.
  • Add tests.

@github-actions github-actions bot added the optuna.samplers Related to the `optuna.samplers` submodule. This is automatically labeled by github-actions. label Sep 26, 2022
@c-bata c-bata self-assigned this Sep 27, 2022
@github-actions
Copy link
Contributor

This pull request has not seen any recent activity.

@github-actions github-actions bot added the stale Exempt from stale bot labeling. label Oct 12, 2022
@github-actions github-actions bot removed the stale Exempt from stale bot labeling. label Oct 23, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Nov 3, 2022

This pull request has not seen any recent activity.

@github-actions github-actions bot added the stale Exempt from stale bot labeling. label Nov 3, 2022
@knshnb knshnb changed the title Support cmaes with margin in CmaEsSampler Support CMA-ES with margin in CmaEsSampler Nov 8, 2022
@codecov-commenter
Copy link

codecov-commenter commented Nov 8, 2022

Codecov Report

Merging #4016 (cb7b6b4) into master (f02f87d) will increase coverage by 0.00%.
The diff coverage is 96.00%.

@@           Coverage Diff           @@
##           master    #4016   +/-   ##
=======================================
  Coverage   90.11%   90.11%           
=======================================
  Files         162      162           
  Lines       12734    12810   +76     
=======================================
+ Hits        11475    11544   +69     
- Misses       1259     1266    +7     
Impacted Files Coverage Δ
optuna/samplers/_cmaes.py 98.61% <96.00%> (-0.37%) ⬇️
optuna/storages/_journal/base.py 78.94% <0.00%> (-2.88%) ⬇️
optuna/integration/botorch.py 97.39% <0.00%> (-0.87%) ⬇️
optuna/integration/skopt.py 97.59% <0.00%> (-0.61%) ⬇️
optuna/storages/_journal/storage.py 96.91% <0.00%> (-0.03%) ⬇️
optuna/testing/storages.py 95.34% <0.00%> (ø)
optuna/integration/chainer.py 89.74% <0.00%> (ø)
optuna/integration/__init__.py 49.15% <0.00%> (ø)
optuna/_hypervolume/__init__.py 100.00% <0.00%> (ø)
optuna/multi_objective/__init__.py 100.00% <0.00%> (ø)
... and 11 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@github-actions github-actions bot removed the stale Exempt from stale bot labeling. label Nov 8, 2022
@knshnb knshnb changed the title Support CMA-ES with margin in CmaEsSampler Support CMA-ES with margin in CmaEsSampler Nov 10, 2022
@knshnb knshnb marked this pull request as ready for review November 10, 2022 11:13
@knshnb
Copy link
Member Author

knshnb commented Nov 10, 2022

Now it's ready for review!

Copy link
Member

@c-bata c-bata left a comment

Choose a reason for hiding this comment

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

Thank you for your pull request!
I took a quick look and left some comments. Let me review the implementation details later.

optuna/samplers/_cmaes.py Outdated Show resolved Hide resolved
optuna/samplers/_cmaes.py Show resolved Hide resolved
optuna/samplers/_cmaes.py Show resolved Hide resolved
@c-bata
Copy link
Member

c-bata commented Nov 14, 2022

@nomuramasahir0 Could you review this PR if you have time?

@nomuramasahir0
Copy link
Contributor

Thank you for the PR about CMA-ES with Margin. LGTM!

@c-bata c-bata added this to the v3.1.0 milestone Nov 14, 2022
@c-bata c-bata added the feature Change that does not break compatibility, but affects the public interfaces. label Nov 14, 2022
optuna/samplers/_cmaes.py Outdated Show resolved Hide resolved
optuna/samplers/_cmaes.py Outdated Show resolved Hide resolved
optuna/samplers/_cmaes.py Outdated Show resolved Hide resolved
Co-authored-by: Masashi Shibata <c-bata@users.noreply.github.com>
Copy link
Member

@c-bata c-bata left a comment

Choose a reason for hiding this comment

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

LGTM with nits!

Although there might be the same issue discussed at #4142 (comment), we should merge this PR first and it should be addressed as a follow-up with the sep-CMA-ES issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Change that does not break compatibility, but affects the public interfaces. optuna.samplers Related to the `optuna.samplers` submodule. This is automatically labeled by github-actions.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants