我知道我可以使用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)