1

我知道我可以使用Optuna进行分布式优化。但是,我不知道我是否可以同时使用多个模型?

例如:

optuna create-study --study-name "distributed-example1" --storage "sqlite:///example.db"

optuna create-study --study-name "distributed-example2" --storage "sqlite:///example.db"

然后在example1.py中:

import optuna

def objective(trial):
    x = trial.suggest_uniform('x', -10, 10)
    return (x - 2) ** 2

if __name__ == '__main__':
    study = optuna.load_study(study_name='distributed-example1', storage='sqlite:///example.db')
    study.optimize(objective, n_trials=100)

然后在example2.py中:

import optuna

def objective(trial):
    x = trial.suggest_uniform('x', -10, 10)
    return (x - 2) ** 2

if __name__ == '__main__':
    study = optuna.load_study(study_name='distributed-example2', storage='sqlite:///example.db')
    study.optimize(objective, n_trials=100)
4

1 回答 1

1

是的你可以。Optuna 支持使用相同的存储 (DB) 同时运行多个研究。

于 2019-11-08T01:05:30.793 回答