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

TypeError: __deepcopy__() takes 1 positional argument but 2 were given #1

Closed
omerfguzel opened this issue Jan 6, 2022 · 4 comments
Closed

Comments

@omerfguzel
Copy link

omerfguzel commented Jan 6, 2022

Hi,
I'm getting this error when I run the ensemble_eval function. Is there any fix suggestions?
TypeError: deepcopy() takes 1 positional argument but 2 were given

@h3ik0th
Copy link
Owner

h3ik0th commented Jan 6, 2022

Hi,
after some experimenting I found that the class RegressionEnsembleModel in Darts has apparently been modified. The argument "forecasting_models" no longer accepts the list "models" of instantiated models.
Below, I commented out the syntax that worked in October and inserted a new line below. In argument "forecasting_models", I list the forecast methods explicitly, one by one.

old:
# ensemble_model = RegressionEnsembleModel(forecasting_models=models, regression_train_n_points=n_train)

new:
ensemble_model = RegressionEnsembleModel(
forecasting_models=[ Theta(best_theta), Prophet(), AutoARIMA(), NaiveDrift() ],
regression_train_n_points=12)

I still need to look if there is any workaround, so that RegressionEnsembleModel accepts instantiated forecast models. The Darts docu doesn't mention anything.

@h3ik0th h3ik0th closed this as completed Jan 7, 2022
@h3ik0th
Copy link
Owner

h3ik0th commented Jan 7, 2022

Revised Juypter notebook uploaded: the new code line I mentioned above prevents the runtime error

@omerfguzel
Copy link
Author

Thank you so much sir, solved my problem.

@dennisbader
Copy link

dennisbader commented Jan 9, 2022

@h3ik0th and @omerfguzel, thanks for that. We will improve the error message, see Darts issue 724.

When creating a model object all parameters are saved.
Deepcopying fitted/trained forecasting_models with EnsembleModels fails.

You can reset your models with models_untrained = [m.untrained_model() for m in models]

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

3 participants