Support 1D Search Spaces in CmaEsSampler#6228
Merged
c-bata merged 7 commits intooptuna:masterfrom Aug 7, 2025
Merged
Conversation
Collaborator
Author
|
Other options of CmaEsSampler worked without errors even when using a 1D search space. |
y0z
reviewed
Aug 1, 2025
optuna/samplers/_cmaes.py
Outdated
| sigma0 = max(sigma0, _EPS) | ||
|
|
||
| if self._use_separable_cma: | ||
| if self._use_separable_cma and not is_single_dimension: |
Member
There was a problem hiding this comment.
It would be helpful to issue a warning when attempting to use sepCMA in 1D, as it is meaningless.
Member
|
@kAIto47802 Could you review this PR? |
CmaEsSampler
y0z
approved these changes
Aug 4, 2025
Member
y0z
left a comment
There was a problem hiding this comment.
LGTM.
I also confirmed that this change works with_margin=True.
optuna.samplers.CmaEsSampler(seed=42, with_margin=True)
Contributor
|
Let me re-assign from @kAIto47802 to @y0z ! |
c-bata
reviewed
Aug 5, 2025
Member
c-bata
left a comment
There was a problem hiding this comment.
Thank you for your pull request. I left two suggestions.
optuna/samplers/_cmaes.py
Outdated
| self, | ||
| trans: _SearchSpaceTransform, | ||
| direction: StudyDirection, | ||
| is_single_dimension: bool, |
Member
There was a problem hiding this comment.
How about checking trans.bounds instead of adding a new argument here?
c-bata
approved these changes
Aug 7, 2025
Member
c-bata
left a comment
There was a problem hiding this comment.
LGTM. Thank you for the update.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Thanks to CMA-ES PR #190, the CMA-ES library now supports 1-dimensional search spaces. This PR updates CmaEsSampler to allow the use of 1D search spaces accordingly.
Description of the changes
use_separable_cma=Trueand the search space is 1D.cmaesversion inpyproject.toml.