You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Expected behavior
The first line above is caught by the sanity checks and raise ValueError: 'The provided forecasting horizon must be a positive integer.' as expected
For the second line however the negative forecast_horizon param clears the sanity checks and produces an error further down the line:
NaiveDrift().backtest(linear_series, None, 0.7, -1)
File ".../darts/utils/utils.py", line 120, in sanitized_method
return method_to_sanitize(self, *args, **kwargs)
File ".../darts/models/forecasting_model.py", line 217, in backtest
pred = self.predict(forecast_horizon, **predict_kwargs)
File ".../darts/models/baselines.py", line 98, in predict
forecast = np.linspace(last, last_value, num=n)
File "<__array_function__ internals>", line 5, in linspace
File ".../lib/python3.8/site-packages/numpy/core/function_base.py", line 115, in linspace
raise ValueError("Number of samples, %s, must be non-negative." % num)
ValueError: Number of samples, -1, must be non-negative.
System (please complete the following information):
Python version: 3.8.5
darts version: develop branch, commit #2977f4f
The text was updated successfully, but these errors were encountered:
Good catch! That's definitely a drawback of the current sanity checks implementation. It mostly relies on arguments being passed as keywords right now.. Do you think this could be a possible solution: https://stackoverflow.com/a/831164?
Describe the bug
Invalid optional arguments to
ForecastingModel.backtest
can bypass sanity checks when provided as positional argumentsTo Reproduce
Expected behavior
The first line above is caught by the sanity checks and raise
ValueError: 'The provided forecasting horizon must be a positive integer.'
as expectedFor the second line however the negative
forecast_horizon
param clears the sanity checks and produces an error further down the line:System (please complete the following information):
The text was updated successfully, but these errors were encountered: