mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-11-30 05:03:54 +00:00
version check for statforecast (#3227)
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user