In forecasting, it is important to consider the full distribution of predictions rather than a single point estimate. Doing so improves the understanding of the uncertainty associated with forecasts and helps with better decision-making.

The TimeGPT library supports uncertainty quantification by enabling both quantile forecasts and the generation of prediction intervals. These features allow you to capture a more comprehensive view of possible outcomes.

Overview

What You Will Learn

Getting Started with Uncertainty Quantification

1

Install or Update TimeGPT

TimeGPT Upgrade
pip install timegpt --upgrade

Make sure you have the latest version of TimeGPT to utilize the most up-to-date uncertainty quantification features.

2

Load Your Data and Model

Prepare and load your time series data. Then instantiate a TimeGPT model. Here’s a simple example:

Load and Fit TimeGPT Model
import pandas as pd
from timegpt import TimeGPT

# Load time series data
df = pd.read_csv("time_series_data.csv")

# Instantiate TimeGPT model
model = TimeGPT()
model.fit(df)
3

Generate Quantile Forecasts

To obtain different quantile forecasts, specify your desired quantiles. For example, to get the 10th, 50th, and 90th percentiles:

Generate Quantile Forecasts
# Generate quantile forecasts
quantiles = [0.1, 0.5, 0.9]
forecasts = model.predict(df, quantiles=quantiles)

print(forecasts)

Using multiple quantiles helps you see a distribution of possible outcomes, beyond a single-best estimate.

4

Create Prediction Intervals

Prediction intervals can be generated by specifying confidence levels. For example, to create a 95% prediction interval:

Create Prediction Interval
interval_forecast = model.predict_intervals(df, level=0.95)
print(interval_forecast)

Prediction intervals provide upper and lower bounds within which future values are expected to lie with a given level of confidence.

Illustration of forecast distribution with quantiles and prediction intervals.

Next Steps

  • Explore Quantile Forecasts to see how quantile predictions can offer a more nuanced view of your data.
  • Dive deeper into Prediction Intervals and learn how to tailor them for your specific confidence levels and use cases.

By incorporating both quantile forecasts and prediction intervals into your forecasting pipeline, you gain a robust understanding of future uncertainties. This knowledge empowers you to make data-driven decisions under varying degrees of risk and confidence.