Add Exogenous Variables
Learn how to incorporate external factors to improve forecast accuracy.
Adding Exogenous Variables to Your Forecasts
Exogenous variables are additional features external to your target time series. They can significantly improve forecasting accuracy when historical and/or future values are available.
Example visualization of exogenous data trends.
1. Set up your environment
Install and import the required libraries:
2. (Optional) Configure Azure AI endpoint
Use an Azure AI endpoint by setting the base_url argument:
3. Choose your exogenous variable approach
Depending on your use case, you can include only historical variables, only future variables, or both.
Historical Exogenous
Use past exogenous data for your forecast by including it in df
.
Future Exogenous
Supply future values of exogenous variables to the X_df
parameter to forecast beyond the historical period.
Historical + Future
Combine both historical and future exogenous data for maximum flexibility and accuracy.
Run on Azure AI Models
When using an Azure AI endpoint, set model="azureai"
:
The public API supports two models: timegpt-1
and timegpt-1-long-horizon
.
By default, timegpt-1
is used.
For more details on exogenous features and long-horizon forecasting, see: