Learn how to predict website traffic patterns using TimeGPT.
1. Import Packages and Initialize Client
base_url
argument:2. Load Data
daily_visits
.Data Preview (first 10 rows)
date | users | unique_id | |
---|---|---|---|
0 | 2020-07-01 | 2324 | daily_visits |
1 | 2020-07-02 | 2201 | daily_visits |
2 | 2020-07-03 | 2146 | daily_visits |
3 | 2020-07-04 | 1666 | daily_visits |
4 | 2020-07-05 | 1433 | daily_visits |
5 | 2020-07-06 | 2195 | daily_visits |
6 | 2020-07-07 | 2240 | daily_visits |
7 | 2020-07-08 | 2295 | daily_visits |
8 | 2020-07-09 | 2279 | daily_visits |
9 | 2020-07-10 | 2155 | daily_visits |
3. Cross-Validation with TimeGPT
Cross-validation forecast plot
167.69
, outperforming the original pipeline.4. Adding Exogenous Variables (Weekday Indicators)
Forecast with Exogenous Variables
5. Comparing Results
Model | Exogenous features | MAE Backtest |
---|---|---|
TimeGPT | No | 167.6917 |
TimeGPT | Yes | 167.2286 |
6. Final Thoughts