TimeGPT is a powerful, general-purpose time series forecasting solution. Throughout this notebook, we compare TimeGPT’s performance against three popular forecasting approaches:
Classical model (ARIMA)
Machine learning model (LightGBM)
Deep learning model (N-HiTS)
Below are three core benefits that our users value the most:
Accuracy
TimeGPT consistently outperforms traditional models by accurately capturing complex patterns.
Speed
Quickly generates forecasts with minimal training and tuning requirements per series.
Ease of Use
Minimal setup and no complex preprocessing make TimeGPT immediately accessible for use.
TimeGPT delivers superior results with minimal effort compared to traditional approaches. In head-to-head testing against ARIMA, LightGBM, and N-HiTS models on M5 competition data, TimeGPT consistently achieves better accuracy metrics (lowest RMSE at 592.6 and SMAPE at 4.94%).Unlike other models which require:
Extensive preprocessing
Parameter tuning
Significant computational resources
TimeGPT provides powerful forecasting capabilities with a simple API interface, making advanced time series analysis accessible to users of all technical backgrounds.
1
1. Data Introduction
This notebook uses an aggregated subset from the M5 Forecasting Accuracy competition. The dataset:
Consists of 7 daily time series
Has 1,941 observations per series
Reserves the last 28 observations for evaluation on unseen data
Data Loading and Stats Preview
import osimport numpy as npimport pandas as pdimport matplotlib.pyplot as pltfrom nixtla import NixtlaClientfrom utilsforecast.plotting import plot_seriesfrom utilsforecast.losses import mae, rmse, smapefrom utilsforecast.evaluation import evaluatenixtla_client = NixtlaClient( # api_key='my_api_key_provided_by_nixtla')df = pd.read_csv( 'https://datasets-nixtla.s3.amazonaws.com/demand_example.csv', parse_dates=['ds'])# Display aggregated statistics per time seriesdf.groupby('unique_id').agg({ "ds": ["min", "max", "count"], "y": ["min", "mean", "median", "max"]})
Below is a preview of the aggregated statistics for each of the 7 time series.
unique_id
min date
max date
count
min y
mean y
median y
max y
FOODS_1
2011-01-29
2016-05-22
1941
0.0
2674.086
2665.0
5493.0
FOODS_2
2011-01-29
2016-05-22
1941
0.0
4015.984
3894.0
9069.0
…
…
…
…
…
…
…
…
Next, we split our dataset into training and test sets. Here, we use data up to “2016-04-24” for training and the remaining data for testing.
2. Model Fitting (TimeGPT, ARIMA, LightGBM, N-HiTS)
TimeGPT is compared against four different modeling approaches. Each approach forecasts the final 28 days of our dataset and we compare results across Root Mean Squared Error (RMSE) and Symmetric Mean Absolute Percentage Error (SMAPE).
2.1 TimeGPT
TimeGPT offers a streamlined solution for time series forecasting with minimal setup.
ARIMA is a common baseline for time series, though it often requires more data preprocessing and does not handle multiple series as efficiently.
ARIMA Forecasting Using StatsForecast
from statsforecast import StatsForecastfrom statsforecast.models import AutoARIMAsf = StatsForecast(models=[AutoARIMA()], freq='D')fcst_arima = sf.forecast(h=28, df=df_train)# Evaluation methods omitted here for brevity
2.3 Machine Learning Models (LightGBM)
LightGBM is a popular gradient-boosted tree approach. However, careful feature engineering is typically required for optimal results.
LightGBM Modeling with AutoMLForecast
import optunafrom mlforecast.auto import AutoMLForecast, AutoLightGBMmlf = AutoMLForecast(models=[AutoLightGBM()], freq='D')mlf.fit(df_train)fcst_lgbm = mlf.predict(28)# Evaluation methods omitted here for brevity
2.4 N-HiTS
N-HiTS is a deep learning architecture for time series. While powerful, it often requires GPU resources and more hyperparameter tuning.
N-HiTS Deep Learning Forecast
from neuralforecast.core import NeuralForecastfrom neuralforecast.models import NHITSnf = NeuralForecast(models=[NHITS()], freq='D')nf.fit(df=df_train)fcst_nhits = nf.predict()# Evaluation methods omitted here for brevity
3
3. Performance Comparison and Results
Below is a summary of the performance metrics (RMSE and SMAPE) on the test dataset. TimeGPT consistently delivers superior forecasting accuracy:
Model
RMSE
SMAPE
ARIMA
724.9
5.50%
LightGBM
687.8
5.14%
N-HiTS
605.0
5.34%
TimeGPT
592.6
4.94%
Comparative Performance Visualization
Benchmark Results
4
4. Conclusion
TimeGPT stands out with its accuracy, speed, and ease of use. Get started today by visiting the
Nixtla dashboard to generate your
api_key and access advanced forecasting with minimal overhead.