Skip to content

Commit

Permalink
Add sigma0 parameter for cmaes sampler
Browse files Browse the repository at this point in the history
--sampler name=cmaes sigma0=20 ...
    default sigma0 or initial std deviation is None. This tells cmaes that optimal parameter values
    lies within init_value +/- 3 * sigma0. By default this value is the parameter minimum_range/6.
    ref: https://optuna.readthedocs.io/en/stable/reference/generated/optuna.integration.PyCmaSampler.html
  • Loading branch information
fsmosca committed Jul 24, 2021
1 parent f36687e commit 65493cd
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions tuner.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

__author__ = 'fsmosca'
__script_name__ = 'Optuna Game Parameter Tuner'
__version__ = 'v0.37.1'
__version__ = 'v0.38.0'
__credits__ = ['joergoster', 'musketeerchess', 'optuna']


Expand Down Expand Up @@ -267,8 +267,14 @@ def get_sampler(args_sampler):
group=group)

if name == 'cmaes':
sigma0 = None # initial std. deviation
for opt in args_sampler:
for value in opt:
if 'sigma0=' in value:
sigma0 = float(value.split('=')[1])

# https://optuna.readthedocs.io/en/stable/reference/generated/optuna.integration.PyCmaSampler.html
return optuna.integration.PyCmaSampler()
return optuna.integration.PyCmaSampler(sigma0=sigma0)

if name == 'skopt':
# https://optuna.readthedocs.io/en/stable/reference/generated/optuna.integration.SkoptSampler.html
Expand Down Expand Up @@ -657,7 +663,10 @@ def main():
' default ei_samples=24\n'
'--sampler name=tpe multivariate=true ...\n'
' default multivariate is false.\n'
'--sampler name=cmaes ...\n'
'--sampler name=cmaes sigma0=20 ...\n'
' default sigma0 or initial std deviation is None. This tells cmaes that optimal parameter values\n'
' lies within init_value +/- 3 * sigma0. By default this value is the parameter minimum_range/6.\n'
' ref: https://optuna.readthedocs.io/en/stable/reference/generated/optuna.integration.PyCmaSampler.html\n'
'--sampler name=skopt acquisition_function=LCB ...\n'
' default acquisition_function=gp_hedge\n'
' Can be LCB or EI or PI or gp_hedge\n'
Expand Down

1 comment on commit 65493cd

@fsmosca
Copy link
Owner Author

@fsmosca fsmosca commented on 65493cd Aug 6, 2021

Choose a reason for hiding this comment

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

See also about cmaes at #11

Please sign in to comment.