version check for statforecast (#3227)

This commit is contained in:
martinb-bb
2022-10-31 18:56:07 -04:00
committed by GitHub
parent 0b51116ec4
commit d6e3881616
2 changed files with 21 additions and 5 deletions

View File

@@ -78,11 +78,23 @@ def get_autoets_data(
ticker_series.columns = ["ds", "y"]
ticker_series.insert(0, "unique_id", target_column)
# Model Init
model_ets = ETS(
season_length=int(seasonal_periods),
)
fcst = StatsForecast(df=ticker_series, models=[model_ets], freq=freq, verbose=True)
try:
# Model Init
model_ets = ETS(
season_length=int(seasonal_periods),
)
fcst = StatsForecast(
df=ticker_series, models=[model_ets], freq=freq, verbose=True
)
except Exception as e: # noqa
error = str(e)
if "got an unexpected keyword argument" in error:
console.print(
"[red]Please update statsforecast to version 1.1.3 or higher.[/red]"
)
else:
console.print(f"[red]{error}[/red]")
return [], [], [], None, None
# Historical backtesting
last_training_point = int((len(ticker_series) - 1) * start_window)

View File

@@ -87,6 +87,10 @@ def display_autoets_forecast(
start_window=start_window,
forecast_horizon=forecast_horizon,
)
if ticker_series == []:
return
probabilistic = False
helpers.plot_forecast(
name="AutoETS",