Skip to content

docs: add tutorial on custom frequencies#597

Merged
MMenchero merged 12 commits intomainfrom
docs-custom-freq
Jan 28, 2025
Merged

docs: add tutorial on custom frequencies#597
MMenchero merged 12 commits intomainfrom
docs-custom-freq

Conversation

@MMenchero
Copy link
Contributor

Description

This tutorial shows how to pass a custom frequency to TimeGPT, in particular, the days the US stock market is open.
This is necessary as several of our users working on financial forecasting use this frequency.

@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@github-actions
Copy link
Contributor

github-actions bot commented Jan 23, 2025

Experiment Results

Experiment 1: air-passengers

Description:

variable experiment
h 12
season_length 12
freq MS
level None
n_windows 1

Results:

metric timegpt-1 timegpt-1-long-horizon SeasonalNaive Naive
mae 12.6793 11.0623 47.8333 76
mape 0.027 0.0232 0.0999 0.1425
mse 213.936 199.132 2571.33 10604.2
total_time 0.7636 0.8035 0.0042 0.0032

Plot:

Experiment 2: air-passengers

Description:

variable experiment
h 24
season_length 12
freq MS
level None
n_windows 1

Results:

metric timegpt-1 timegpt-1-long-horizon SeasonalNaive Naive
mae 58.1031 58.4587 71.25 115.25
mape 0.1257 0.1267 0.1552 0.2358
mse 4040.21 4110.79 5928.17 18859.2
total_time 1.0719 0.9171 0.0048 0.0034

Plot:

Experiment 3: electricity-multiple-series

Description:

variable experiment
h 24
season_length 24
freq H
level None
n_windows 1

Results:

metric timegpt-1 timegpt-1-long-horizon SeasonalNaive Naive
mae 178.293 268.13 269.23 1331.02
mape 0.0234 0.0311 0.0304 0.1692
mse 121589 219485 213677 4.68961e+06
total_time 0.8005 2.8258 0.0048 0.0043

Plot:

Experiment 4: electricity-multiple-series

Description:

variable experiment
h 168
season_length 24
freq H
level None
n_windows 1

Results:

metric timegpt-1 timegpt-1-long-horizon SeasonalNaive Naive
mae 465.497 346.972 398.956 1119.26
mape 0.062 0.0436 0.0512 0.1583
mse 835021 403760 656723 3.17316e+06
total_time 0.8551 0.9843 0.005 0.0044

Plot:

Experiment 5: electricity-multiple-series

Description:

variable experiment
h 336
season_length 24
freq H
level None
n_windows 1

Results:

metric timegpt-1 timegpt-1-long-horizon SeasonalNaive Naive
mae 558.673 459.757 602.926 1340.95
mape 0.0697 0.0565 0.0787 0.17
mse 1.22723e+06 739114 1.61572e+06 6.04619e+06
total_time 0.987 1.0628 0.005 0.0046

Plot:

@marcopeix
Copy link
Contributor

I think it would be good to also include the integer frequency for highly irregular time series. Wdyt?

@MMenchero MMenchero removed the request for review from Yibei990826 January 24, 2025 00:21
@MMenchero
Copy link
Contributor Author

I thought about what you suggested @marcopeix but I don't want to add another dataset as the tutorial already has 2. If it’s possible to use the plt dataset, I’d really appreciate it if you could let me know.

@marcopeix
Copy link
Contributor

I thought about what you suggested @marcopeix but I don't want to add another dataset as the tutorial already has 2. If it’s possible to use the plt dataset, I’d really appreciate it if you could let me know.

You can use the PLT dataset. The ds column would have to be integers, and then you specify freq=1. Drawback of that is that you then don't know the specific date. Maybe it would over complicate the tutorial, so never mind!

PR looks good to me! Quick reminder, you must update the mint.json file with the new tutorial notebook!

@MMenchero
Copy link
Contributor Author

Thanks @marcopeix since the nb already exists, using the old name should be equivalent to changing the mint.json.

This is ready for review @AzulGarza

@@ -4,10 +4,29 @@
"cell_type": "code",
Copy link
Contributor

@marcopeix marcopeix Jan 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line #4.        'https://raw.githubusercontent.com/Nixtla/transfer-learning-time-series/main/datasets/air_passengers.csv',

Maybe we can set the url in a separate variable and use it in the function? I think it would make the code cleaner.


Reply via ReviewNB

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@@ -4,10 +4,29 @@
"cell_type": "code",
Copy link
Contributor

@marcopeix marcopeix Jan 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line #8.    polars_df 

I think we can remove this, since it won't be displayed in the notebook


Reply via ReviewNB

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed.

@@ -4,10 +4,29 @@
"cell_type": "code",
Copy link
Contributor

@marcopeix marcopeix Jan 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line #1.    pltr_df = pd.read_csv('https://raw.githubusercontent.com/Nixtla/transfer-learning-time-series/main/datasets/openbb/pltr.csv', parse_dates=['date'])

Same comment as before for the url. Feel free to disregard if you don't feel it's relevant.


Reply via ReviewNB

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, agree it is cleaner.

@marcopeix marcopeix self-requested a review January 27, 2025 22:25
Copy link
Contributor

@marcopeix marcopeix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@MMenchero MMenchero merged commit 9d703f5 into main Jan 28, 2025
19 checks passed
@MMenchero MMenchero deleted the docs-custom-freq branch January 28, 2025 00:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants