首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >初始值为x0的optuna cmaes?

初始值为x0的optuna cmaes?
EN

Stack Overflow用户
提问于 2021-04-23 09:52:27
回答 1查看 25关注 0票数 0

我的代码:

代码语言:javascript
复制
import optuna


def objective(trial):
    x = trial.suggest_float('x', -100.0, 100.0)
    y = trial.suggest_float('y', -100.0, 100.0)
    return x**2 + y**2

study = optuna.create_study(sampler=optuna.samplers.CmaEsSampler(x0={'x':0,'y':0}))
study.optimize(objective, n_trials=100,show_progress_bar=True)

然后输出

代码语言:javascript
复制
[I 2021-04-23 01:45:02,653] Trial 0 finished with value: 6714.428295151254 and parameters: {'x': 63.88749911037144, 'y': 51.310971074162524}. Best is trial 0 with value: 6714.428295151254.
[I 2021-04-23 01:45:02,663] Trial 1 finished with value: 1135.0978476605947 and parameters: {'x': 29.936795325284184, 'y': 15.45594168314043}. Best is trial 1 with value: 1135.0978476605947.
[I 2021-04-23 01:45:02,681] Trial 2 finished with value: 3149.451283583515 and parameters: {'x': 25.743779033527815, 'y': -49.866914128071016}. Best is trial 1 with value: 1135.0978476605947.

为什么算法没有根据我给出的x0生成初始值

EN

回答 1

Stack Overflow用户

发布于 2021-10-23 11:36:26

x0不是一个参数建议,它是由cmaes采样器后面的库使用的。

代码语言:javascript
复制
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.

https://optuna.readthedocs.io/en/stable/_modules/optuna/samplers/_cmaes.html#CmaEsSampler

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/67222968

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档