To use covariates with Darts forecasting models, ensure all covariates are provided as TimeSeries objects. When training with fit(), you must supply the same types of covariates during predict() that were used during training. Darts can automatically slice covariates to match the target time axis if they contain sufficient time spans.
Key Requirements:
past_covariates and future_covariates must be TimeSeries objects.- The types of covariates used in
fit() must match those used in predict(). - For Global Forecasting Models (GFMs), you must provide the
series argument in predict() to specify which target series you are forecasting.
# create one of Darts' forecasting model
model = SomeForecastingModel(...)
# fit the model
model.fit(target,
past_covariates=past_covariate,
future_covariates=future_covariates)
# make a prediction with the same covariate types
pred = model.predict(n=1,
series=target, # this is only required for GFMs
past_covariates=past_covariates,
future_covariates=future_covariates)