model='timegpt-1-long-horizon'
in your setup.
For a detailed step-by-step guide, follow this tutorial on long-horizon
forecasting.
1. Import packages
First, we install and import the required packages and initialize the Nixtla client.👍 Use an Azure AI endpoint To use an Azure AI endpoint, remember to set also thebase_url
argument:nixtla_client = NixtlaClient(base_url="you azure ai endpoint", api_key="your api_key")
2. Load the data
Let’s load the ETTh1 dataset. This is a widely used dataset to evaluate models on their long-horizon forecasting capabalities. The ETTh1 dataset monitors an electricity transformer from a region of a province of China including oil temperature and variants of load (such as high useful load and high useless load) from July 2016 to July 2018 at an hourly frequency. For this tutorial, let’s only consider the oil temperature variation over time.unique_id | ds | y | |
---|---|---|---|
0 | OT | 2016-07-01 00:00:00 | 1.460552 |
1 | OT | 2016-07-01 01:00:00 | 1.161527 |
2 | OT | 2016-07-01 02:00:00 | 1.161527 |
3 | OT | 2016-07-01 03:00:00 | 0.862611 |
4 | OT | 2016-07-01 04:00:00 | 0.525227 |
3. Forecasting for long-horizon
Now, we are ready to use TimeGPT for long-horizon forecasting. Here, we need to set themodel
parameter to "timegpt-1-long-horizon"
. This is
the specialized model in TimeGPT that can handle such tasks.
📘 Available models in Azure AI If you are using an Azure AI endpoint, please be sure to setmodel="azureai"
:nixtla_client.forecast(..., model="azureai")
