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

ForecastingModel.backtest() fails if forecast_horizon isn't provided #186

Closed
LeoTafti opened this issue Sep 17, 2020 · 1 comment
Closed
Labels
bug Something isn't working

Comments

@LeoTafti
Copy link
Contributor

if hasattr(n, 'forecast_horizon'):
raise_if_not(n.forecast_horizon > 0, 'The provided forecasting horizon must be a positive integer.', logger)
# check start parameter
if hasattr(n, 'start'):
if isinstance(n.start, float):
raise_if_not(n.start >= 0.0 and n.start < 1.0, '`start` should be between 0.0 and 1.0.', logger)
elif isinstance(n.start, pd.Timestamp):
if (hasattr(n, 'trim_to_series') and n.trim_to_series) or not hasattr(n, 'trim_to_series'):
raise_if_not(n.start + training_series.freq() * n.forecast_horizon in training_series,

n.forecast_horizon at line 157 fails when hasattr(n, 'forecast_horizon') == false, ie. every time no explicit value is passed when calling backtest()

Error produced:

AttributeError: 'types.SimpleNamespace' object has no attribute 'forecast_horizon'
@LeoTafti LeoTafti added the bug Something isn't working label Sep 17, 2020
@LeoTafti
Copy link
Contributor Author

I'm sure how to go about fixing it, since performing the check on line 157 requires to know forecast_horizon value, but we don't have it in _backtest_sanity_checks when the call to backtest() didn't specify it and used the default value…

@LeoTafti LeoTafti linked a pull request Sep 22, 2020 that will close this issue
@LeoTafti LeoTafti removed a link to a pull request Sep 22, 2020
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

Successfully merging a pull request may close this issue.

1 participant