具有初始值 x0 的 optuna cmaes?

问题描述

我的代码

import optuna


def objective(trial):
    x = trial.suggest_float('x',-100.0,100.0)
    y = trial.suggest_float('y',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)

然后输出

[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做初始值

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)