Long-horizon forecasting
Learn how to predict multiple seasonal cycles into the future using TimeGPT
Long-horizon forecasting is used to predict multiple seasonal cycles into the future. The TimeGPT model offers long-term forecasting capabilities by setting the parameter model="timegpt-1-long-horizon"
.
This page provides an overview of how to perform long-horizon forecasting using the Nixtla Client. You’ll also learn how to switch between default and Azure AI endpoints.
Overview
Long-horizon forecasting allows you to forecast beyond one full seasonal cycle. For example, if monthly data exhibits annual seasonality, you can project several years into the future. TimeGPT’s long-horizon variant can handle these extended forecasts.
Step 1 — Install and Import Libraries
Step 2 — Initialize Nixtla Client
You can initialize the Nixtla Client by providing your API key:
Use an Azure AI endpoint
To use an Azure AI endpoint, explicitly specify the base_url
parameter:
Step 3 — Load Data and Create Forecast
Load your time series data into a Pandas DataFrame, then call the forecast
method:
Step 4 — Review Logs
The Nixtla Client emits helpful messages and warnings during the forecasting process:
When the specified horizon h
exceeds the model’s recommended horizon, the accuracy may be lower. Consider adjusting h
based on your forecasting needs.
Model Options
If using an Azure AI endpoint, explicitly select the Azure model with:
timegpt-1
Default model for general forecasting tasks.
timegpt-1-long-horizon
For extended (long-horizon) forecasts.
azureai
For Nixtla services running on your Azure endpoint.
Refer to the Tutorial on Long-horizon Forecasting for best practices and guidance on choosing the right model for your use case.
For a comprehensive walkthrough on forecasting more than one season ahead, visit the complete tutorial on Long-horizon forecasting.