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

bayesian_search_forecaster (Optuna) & Saving/Resuming Study with RDB Backend #624

Open
wheredoesyourmindgo opened this issue Jan 14, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@wheredoesyourmindgo
Copy link

I'm trying to figure out if there is a way to pick up where I left off with the bayesian_search_forecaster().

After I create a SQLite DB as described on Saving/Resuming Study with RDB Backend, I get the following error on a 2nd execution of the following function.

results, frozen_trial = bayesian_search_forecaster(
                           ...,
                            metric = 'mean_absolute_error',
                            kwargs_create_study  = {
                                 'study_name': "model-study",
                                 'storage': "sqlite:///model-study.db",
                                'load_if_exists': True
                            },
                            kwargs_study_optimize = {}
                        )

Error:

File ~/.../lib/python3.8/site-packages/skforecast/model_selection/model_selection.py:1584, in _bayesian_search_optuna(forecaster, y, search_space, steps, metric, initial_train_size, fixed_train_size, gap, allow_incomplete_fold, exog, lags_grid, refit, n_trials, random_state, return_best, n_jobs, verbose, show_progress, kwargs_create_study, kwargs_study_optimize)
1581 params_list.append(trial.params)
1582 lags_list.append(lags)
-> 1584 for m, m_values in zip(metric, metric_values[i]):
1585 m_name = m if isinstance(m, str) else m.name
1586 metric_dict[m_name].append(m_values)

IndexError: list index out of range

@JoaquinAmatRodrigo
Copy link
Owner

Hi @wheredoesyourmindgo
Thanks for using skforecast and reporting this error.
It seems there is a bug in the way we internally call optuna.create_study() within bayesian_search_forecaster(). We will try to fix this in the next release.

@JoaquinAmatRodrigo JoaquinAmatRodrigo added the bug Something isn't working label Jan 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants