Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multi objective optimization seems unavailable #920

Open
jxnu-liguobin opened this issue Sep 2, 2024 · 0 comments
Open

Multi objective optimization seems unavailable #920

jxnu-liguobin opened this issue Sep 2, 2024 · 0 comments

Comments

@jxnu-liguobin
Copy link

https://github.com/optuna/optuna-examples/blob/main/multi_objective/botorch_simple.py
According to optuna examples, I passed in the list.

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
Cell In[193], line 29
     26     mae=mean_absolute_error(test_y, test_preds)
     27     return mae
---> 29 run_optuna_study(objective, study_type='bayesian', n_trials=32, direction=['minimize','minimize'])

File ~/anaconda3/envs/ai4c/lib/python3.11/site-packages/tsai/optuna.py:77, in run_optuna_study(objective, resume, study_type, multivariate, search_space, evaluate, seed, sampler, pruner, study_name, direction, n_trials, timeout, gc_after_trial, show_progress_bar, save_study, path, show_plots)
     75         print(f"    {key}: {value}")
     76 else: 
---> 77     study = optuna.create_study(sampler=sampler, pruner=pruner, study_name=study_name, direction=direction)
     78 if evaluate: study.enqueue_trial(evaluate)
     79 try:

File ~/anaconda3/envs/ai4c/lib/python3.11/site-packages/optuna/_convert_positional_args.py:83, in convert_positional_args.<locals>.converter_decorator.<locals>.converter_wrapper(*args, **kwargs)
     77     raise TypeError(
     78         f"{func.__name__}() got multiple values for arguments {duplicated_kwds}."
     79     )
     81 kwargs.update(inferred_kwargs)
---> 83 return func(**kwargs)

File ~/anaconda3/envs/ai4c/lib/python3.11/site-packages/optuna/study/study.py:1240, in create_study(storage, sampler, pruner, study_name, direction, load_if_exists, directions)
   1235     raise ValueError("The number of objectives must be greater than 0.")
   1236 elif any(
   1237     d not in ["minimize", "maximize", StudyDirection.MINIMIZE, StudyDirection.MAXIMIZE]
   1238     for d in directions
   1239 ):
-> 1240     raise ValueError(
   1241         "Please set either 'minimize' or 'maximize' to direction. You can also set the "
   1242         "corresponding `StudyDirection` member."
   1243     )
   1245 direction_objects = [
   1246     d if isinstance(d, StudyDirection) else StudyDirection[d.upper()] for d in directions
   1247 ]
   1249 storage = storages.get_storage(storage)

ValueError: Please set either 'minimize' or 'maximize' to direction. You can also set the corresponding `StudyDirection` member.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant