https://github.com/nixtla logo
#general
Title
# general
k

Kevin Kho

11/10/2022, 3:46 PM
Do you know if the
forecast
function in the utils can take exogenous regressors? Code snippet in thread
❤️ 1
i have a quick file here to test
Copy code
import pandas as pd
from statsforecast.distributed.utils import forecast
from statsforecast.distributed.fugue import FugueBackend
from statsforecast.models import AutoARIMA

df = pd.read_parquet(f"{WORKING_DIR}/combined.parquet")[["unique_id", "ds", "y","sell_price"]]
result = forecast(df, 
                  models=[AutoARIMA(season_length=7)], 
                  freq="D", 
                  h=7,
                  parallel=FugueBackend("dask"))
result.compute()
Maybe I have something wrong but this is pretty close to the tutorial and I get the same error
Copy code
from statsforecast import StatsForecast

df = pd.read_parquet(f"{WORKING_DIR}/combined.parquet")
df = df[["unique_id", "ds", "y","sell_price"]]

model = StatsForecast(
    df=df,
    models=[AutoARIMA(season_length=7)], 
    freq='D', 
    n_jobs=-1
)
model.forecast(7)
f

fede (nixtla) (they/them)

11/10/2022, 6:46 PM
hey @Kevin Kho! Future variables must be included in the
forecast
method to use exogenous variables. That is, the code would be:
Copy code
model.forecast(7, X_df=future_exogenous)
For example, if you are using weather as an exogenous variable, you must include the weather for the days you generate the forecasts.
For a distributed setting, we’ve opened a PR to add the functionality to fugue’s backend: https://github.com/Nixtla/statsforecast/pull/300
here’s an example using databricks
k

Kevin Kho

11/10/2022, 6:56 PM
Ahhh ok got it!