timeseriesAI / tsai

Time series Timeseries Deep Learning Machine Learning Python Pytorch fastai | State-of-the-art Deep Learning library for Time Series and Sequences in Pytorch / fastai
https://timeseriesai.github.io/tsai/
Apache License 2.0
5.14k stars 643 forks source link

Multi objective optimization seems unavailable #920

Open jxnu-liguobin opened 1 month ago

jxnu-liguobin commented 1 month ago

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.