Skip to content

Deprecate x0 and sigma0 options in CmaEsSampler - #6624

Merged
y0z merged 3 commits into
optuna:masterfrom
c-bata:remove-cmaes-x0-sigma0
Apr 21, 2026
Merged

y0z merged 3 commits into
optuna:masterfrom
c-bata:remove-cmaes-x0-sigma0

Conversation

@c-bata

@c-bata c-bata commented Apr 14, 2026

Copy link
Copy Markdown
Member

Motivation

The x0 and sigma0 options were originally inherited from PyCmaSampler. However, these options are difficult to use and require an unnecessarily deep understanding of CmaEsSampler's internal implementation.

Following a discussion with the core development team, we have decided to deprecate these options to simplify the API.

Description of the changes

  • Deprecate x0 and sigma0 options in CmaEsSampler
  • Enforce keyword-only arguments in CmaEsSampler by deprecating positional arguments.

@c-bata c-bata added the compatibility Change that breaks compatibility. label Apr 14, 2026
@c-bata
c-bata marked this pull request as ready for review April 14, 2026 10:23
@not522 not522 assigned not522 and y0z Apr 15, 2026
@not522

not522 commented Apr 15, 2026

Copy link
Copy Markdown
Member

@y0z Could you review this PR?

Comment thread optuna/samplers/_cmaes.py
Comment on lines 116 to +123
x0:
A dictionary of an initial parameter values for CMA-ES. By default, the mean of ``low``
and ``high`` for each distribution is used. Note that ``x0`` is sampled uniformly
within the search space domain for each restart if you specify ``restart_strategy``
argument.
and ``high`` for each distribution is used.

.. warning::
Deprecated in v4.9.0. ``sigma0`` argument will be removed in the future.
The removal of this feature is currently scheduled for v6.0.0,
but this schedule is subject to change.

@c-bata c-bata Apr 15, 2026 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Should we remove x0 and sigma0 from the docs? If you agree, I'll address this in a separate PR (including restart_strategy option which was already deprecated).

@c-bata
c-bata force-pushed the remove-cmaes-x0-sigma0 branch from cc49857 to 47a4b7b Compare April 15, 2026 06:58

@not522 not522 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you for your PR. Please check my comments.

Comment thread optuna/samplers/_cmaes.py Resolved
Comment thread optuna/samplers/_cmaes.py Resolved
Comment thread optuna/samplers/_cmaes.py Resolved
c-bata and others added 2 commits April 17, 2026 12:41

@not522 not522 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM!

@not522 not522 removed their assignment Apr 17, 2026
@y0z

y0z commented Apr 17, 2026

Copy link
Copy Markdown
Member

It seems that CIs still fail with respect to self.

TypeError: __init__() missing 1 required positional argument: 'self'

@not522

not522 commented Apr 17, 2026

Copy link
Copy Markdown
Member

Sorry, self should have been included in previous_positional_arg_names of convert_positional_args. The warning message in convert_positional_args is incorrect, so I'll fix it in a separate PR.

@not522
not522 self-requested a review April 17, 2026 05:45
@not522 not522 self-assigned this Apr 17, 2026
@c-bata
c-bata force-pushed the remove-cmaes-x0-sigma0 branch from 8c13d2d to 84e4459 Compare April 17, 2026 06:09
@c-bata

c-bata commented Apr 17, 2026

Copy link
Copy Markdown
Member Author

No, problem. I've removed the latest commit and force-pushed. Thank you for your thorough review!

@not522 not522 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM!

@not522 not522 removed their assignment Apr 17, 2026

@y0z y0z left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@y0z
y0z merged commit 28ebd01 into optuna:master Apr 21, 2026
24 checks passed
@y0z y0z removed their assignment Apr 21, 2026
@c-bata c-bata added this to the v4.9.0 milestone Apr 24, 2026
@c-bata
c-bata deleted the remove-cmaes-x0-sigma0 branch May 1, 2026 02:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

compatibility Change that breaks compatibility.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants