Toni Borders
10/30/2023, 9:51 AM# define model(s)
ts_models = [
AutoETS(model=['Z','Z','Z'], season_length=season, alias='AE')
]
# Instantiate StatsForecast class
model = StatsForecast(df = train,
models=ts_models,
freq = 'H',
n_jobs=-1)
# Forecast
forecast = model.forecast(h=1500, level=[95])
Error:
_‘StatsForecast’ object has no attribute ‘fitted_’_
However if I use the fit and predict methods with the code below, the forecast is successful.
# plot data
StatsForecast.plot(train, engine='plotly')
# define model(s)
ts_models = [
AutoETS(model=['Z','Z','Z'], season_length=season, alias='AE')
]
# Instantiate StatsForecast class
model = StatsForecast(
models=ts_models,
freq = 'H',
n_jobs=-1)
model.fit(train)
# Forecast
h = round((valid['ds'].nunique()) * 0.5)
forecast = model.predict(h=h, level=[95])
model.plot(df, forecast, engine='plotly')
Any ideas why the more efficient forecast method is not working in my case?
2. And a secondary issue, is that the StatsForecast.plot() is also not working when I run in a script in PyCharm.
If anyone has guidance on this second query it would be appreciated.Mariana Menchero
10/30/2023, 6:55 PMh = round((valid['ds'].nunique()) * 0.5)
Is this also equal to 1500?Toni Borders
10/31/2023, 8:40 AMTraceback (most recent call last):
File "/<path>/<my_script>.py", line 297, in <module>
main(data)
File "/<path>/<my_script>.py", line 277, in main
forecast, model_aliases = forecast_only(dfUsage_clean, season)
File "/<path>/<my_script>.py", line 125, in forecast_only
forecast = model.forecast(h=h, level=[95])
File "<site-packages_path>/statsforecast/core.py", line 1899, in forecast
return super().forecast(
File "<site-packages_path>/statsforecast/core.py", line 1097, in forecast
res_fcsts = self._forecast_parallel(h=h, fitted=fitted, X=X, level=level)
File "<site-packages_path>/statsforecast/core.py", line 1376, in _forecast_parallel
gas, Xs = self._get_gas_Xs(X=X)
File "<site-packages_path>/statsforecast/core.py", line 1315, in _get_gas_Xs
gas = self.ga.split(self.n_jobs)
AttributeError: 'StatsForecast' object has no attribute 'ga'
José Morales
11/01/2023, 5:34 PMmodel.forecast(df=train, h=h, level=[95])
Toni Borders
11/02/2023, 10:10 AM