azrai99 commited on
Commit
20076a8
·
verified ·
1 Parent(s): f3f15dd

Upload 4 files

Browse files
src/__pycache__/nf.cpython-311.pyc ADDED
Binary file (10.1 kB). View file
 
src/model_descriptions.py ADDED
@@ -0,0 +1,522 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ model_cards = dict(
2
+ nhitsm={
3
+ "Abstract": (
4
+ "The N-HiTS_M incorporates hierarchical interpolation and multi-rate data sampling "
5
+ "techniques. It assembles its predictions sequentially, selectively emphasizing "
6
+ "components with different frequencies and scales, while decomposing the input signal "
7
+ " and synthesizing the forecast [Cristian Challu, Kin G. Olivares, Boris N. Oreshkin, "
8
+ "Federico Garza, Max Mergenthaler-Canseco, Artur Dubrawski. N-HiTS: Neural "
9
+ "Hierarchical Interpolation for Time Series Forecasting, Submitted working paper.]"
10
+ "(https://arxiv.org/abs/2201.12886)"
11
+ ),
12
+ "Intended use": (
13
+ "The N-HiTS_M model specializes in monthly long-horizon forecasting by improving "
14
+ "accuracy and reducing the training time and memory requirements of the model."
15
+ ),
16
+ "Secondary use": (
17
+ "The interpretable predictions of the model produce a natural frequency time "
18
+ "series signal decomposition."
19
+ ),
20
+ "Limitations": (
21
+ "The transferability across different frequencies has not yet been tested, it is "
22
+ "advisable to restrict the use of N-HiTS_{M} to monthly data were it was pre-trained. "
23
+ "This model purely autorregresive, transferability of models with exogenous variables "
24
+ "is yet to be done."
25
+ ),
26
+ "Training data": (
27
+ "N-HiTS_M was trained on 48,000 monthly series from the M4 competition "
28
+ "[Spyros Makridakis, Evangelos Spiliotis, and Vassilios Assimakopoulos. The "
29
+ " M4 competition: 100,000 time series and 61 forecasting methods. International "
30
+ "Journal of Forecasting, 36(1):54–74, 2020. ISSN 0169-2070.]"
31
+ "(https://www.sciencedirect.com/science/article/pii/S0169207019301128)"
32
+ ),
33
+ "Citation Info": (
34
+ "@article{challu2022nhits,\n "
35
+ "author = {Cristian Challu and \n"
36
+ " Kin G. Olivares and \n"
37
+ " Boris N. Oreshkin and \n"
38
+ " Federico Garza and \n"
39
+ " Max Mergenthaler and \n"
40
+ " Artur Dubrawski}, \n "
41
+ "title = {N-HiTS: Neural Hierarchical Interpolation for Time Series Forecasting},\n "
42
+ "journal = {Computing Research Repository},\n "
43
+ "volume = {abs/2201.12886},\n "
44
+ "year = {2022},\n "
45
+ "url = {https://arxiv.org/abs/2201.12886},\n "
46
+ "eprinttype = {arXiv},\n "
47
+ "eprint = {2201.12886},\n "
48
+ "biburl = {https://dblp.org/rec/journals/corr/abs-2201-12886.bib}\n}"
49
+ ),
50
+ },
51
+ nhitsh={
52
+ "Abstract": (
53
+ "The N-HiTS_{H} incorporates hierarchical interpolation and multi-rate data sampling "
54
+ "techniques. It assembles its predictions sequentially, selectively emphasizing "
55
+ "components with different frequencies and scales, while decomposing the input signal "
56
+ " and synthesizing the forecast [Cristian Challu, Kin G. Olivares, Boris N. Oreshkin, "
57
+ "Federico Garza, Max Mergenthaler-Canseco, Artur Dubrawski. N-HiTS: Neural "
58
+ "Hierarchical Interpolation for Time Series Forecasting, Submitted working paper.]"
59
+ "(https://arxiv.org/abs/2201.12886)"
60
+ ),
61
+ "Intended use": (
62
+ "The N-HiTS_{H} model specializes in hourly long-horizon forecasting by improving "
63
+ "accuracy and reducing the training time and memory requirements of the model."
64
+ ),
65
+ "Secondary use": (
66
+ "The interpretable predictions of the model produce a natural frequency time "
67
+ "series signal decomposition."
68
+ ),
69
+ "Limitations": (
70
+ "The transferability across different frequencies has not yet been tested, it is "
71
+ "advisable to restrict the use of N-HiTS_{H} to hourly data were it was pre-trained. "
72
+ "This model purely autorregresive, transferability of models with exogenous variables "
73
+ "is yet to be done."
74
+ ),
75
+ "Training data": (
76
+ "N-HiTS_{H} was trained on 414 hourly series from the M4 competition "
77
+ "[Spyros Makridakis, Evangelos Spiliotis, and Vassilios Assimakopoulos. The "
78
+ " M4 competition: 100,000 time series and 61 forecasting methods. International "
79
+ "Journal of Forecasting, 36(1):54–74, 2020. ISSN 0169-2070.]"
80
+ "(https://www.sciencedirect.com/science/article/pii/S0169207019301128)"
81
+ ),
82
+ "Citation Info": (
83
+ "@article{challu2022nhits,\n "
84
+ "author = {Cristian Challu and \n"
85
+ " Kin G. Olivares and \n"
86
+ " Boris N. Oreshkin and \n"
87
+ " Federico Garza and \n"
88
+ " Max Mergenthaler and \n"
89
+ " Artur Dubrawski}, \n "
90
+ "title = {N-HiTS: Neural Hierarchical Interpolation for Time Series Forecasting},\n "
91
+ "journal = {Computing Research Repository},\n "
92
+ "volume = {abs/2201.12886},\n "
93
+ "year = {2022},\n "
94
+ "url = {https://arxiv.org/abs/2201.12886},\n "
95
+ "eprinttype = {arXiv},\n "
96
+ "eprint = {2201.12886},\n "
97
+ "biburl = {https://dblp.org/rec/journals/corr/abs-2201-12886.bib}\n}"
98
+ ),
99
+ },
100
+ nhitsd={
101
+ "Abstract": (
102
+ "The N-HiTS_D incorporates hierarchical interpolation and multi-rate data sampling "
103
+ "techniques. It assembles its predictions sequentially, selectively emphasizing "
104
+ "components with different frequencies and scales, while decomposing the input signal "
105
+ " and synthesizing the forecast [Cristian Challu, Kin G. Olivares, Boris N. Oreshkin, "
106
+ "Federico Garza, Max Mergenthaler-Canseco, Artur Dubrawski. N-HiTS: Neural "
107
+ "Hierarchical Interpolation for Time Series Forecasting, Submitted working paper.]"
108
+ "(https://arxiv.org/abs/2201.12886)"
109
+ ),
110
+ "Intended use": (
111
+ "The N-HiTS_D model specializes in daily long-horizon forecasting by improving "
112
+ "accuracy and reducing the training time and memory requirements of the model."
113
+ ),
114
+ "Secondary use": (
115
+ "The interpretable predictions of the model produce a natural frequency time "
116
+ "series signal decomposition."
117
+ ),
118
+ "Limitations": (
119
+ "The transferability across different frequencies has not yet been tested, it is "
120
+ "advisable to restrict the use of N-HiTS_D to daily data were it was pre-trained. "
121
+ "This model purely autorregresive, transferability of models with exogenous variables "
122
+ "is yet to be done."
123
+ ),
124
+ "Training data": (
125
+ "N-HiTS_D was trained on 4,227 daily series from the M4 competition "
126
+ "[Spyros Makridakis, Evangelos Spiliotis, and Vassilios Assimakopoulos. The "
127
+ " M4 competition: 100,000 time series and 61 forecasting methods. International "
128
+ "Journal of Forecasting, 36(1):54–74, 2020. ISSN 0169-2070.]"
129
+ "(https://www.sciencedirect.com/science/article/pii/S0169207019301128)"
130
+ ),
131
+ "Citation Info": (
132
+ "@article{challu2022nhits,\n "
133
+ "author = {Cristian Challu and \n"
134
+ " Kin G. Olivares and \n"
135
+ " Boris N. Oreshkin and \n"
136
+ " Federico Garza and \n"
137
+ " Max Mergenthaler and \n"
138
+ " Artur Dubrawski}, \n "
139
+ "title = {N-HiTS: Neural Hierarchical Interpolation for Time Series Forecasting},\n "
140
+ "journal = {Computing Research Repository},\n "
141
+ "volume = {abs/2201.12886},\n "
142
+ "year = {2022},\n "
143
+ "url = {https://arxiv.org/abs/2201.12886},\n "
144
+ "eprinttype = {arXiv},\n "
145
+ "eprint = {2201.12886},\n "
146
+ "biburl = {https://dblp.org/rec/journals/corr/abs-2201-12886.bib}\n}"
147
+ ),
148
+ },
149
+ nhitsy={
150
+ "Abstract": (
151
+ "The N-HiTS_Y incorporates hierarchical interpolation and multi-rate data sampling "
152
+ "techniques. It assembles its predictions sequentially, selectively emphasizing "
153
+ "components with different frequencies and scales, while decomposing the input signal "
154
+ " and synthesizing the forecast [Cristian Challu, Kin G. Olivares, Boris N. Oreshkin, "
155
+ "Federico Garza, Max Mergenthaler-Canseco, Artur Dubrawski. N-HiTS: Neural "
156
+ "Hierarchical Interpolation for Time Series Forecasting, Submitted working paper.]"
157
+ "(https://arxiv.org/abs/2201.12886)"
158
+ ),
159
+ "Intended use": (
160
+ "The N-HiTS_Y model specializes in yearly long-horizon forecasting by improving "
161
+ "accuracy and reducing the training time and memory requirements of the model."
162
+ ),
163
+ "Secondary use": (
164
+ "The interpretable predictions of the model produce a natural frequency time "
165
+ "series signal decomposition."
166
+ ),
167
+ "Limitations": (
168
+ "The transferability across different frequencies has not yet been tested, it is "
169
+ "advisable to restrict the use of N-HiTS_Y to yearly data were it was pre-trained. "
170
+ "This model purely autorregresive, transferability of models with exogenous variables "
171
+ "is yet to be done."
172
+ ),
173
+ "Training data": (
174
+ "N-HiTS_{H} was trained on 23,000 yearly series from the M4 competition "
175
+ "[Spyros Makridakis, Evangelos Spiliotis, and Vassilios Assimakopoulos. The "
176
+ " M4 competition: 100,000 time series and 61 forecasting methods. International "
177
+ "Journal of Forecasting, 36(1):54–74, 2020. ISSN 0169-2070.]"
178
+ "(https://www.sciencedirect.com/science/article/pii/S0169207019301128)"
179
+ ),
180
+ "Citation Info": (
181
+ "@article{challu2022nhits,\n "
182
+ "author = {Cristian Challu and \n"
183
+ " Kin G. Olivares and \n"
184
+ " Boris N. Oreshkin and \n"
185
+ " Federico Garza and \n"
186
+ " Max Mergenthaler and \n"
187
+ " Artur Dubrawski}, \n "
188
+ "title = {N-HiTS: Neural Hierarchical Interpolation for Time Series Forecasting},\n "
189
+ "journal = {Computing Research Repository},\n "
190
+ "volume = {abs/2201.12886},\n "
191
+ "year = {2022},\n "
192
+ "url = {https://arxiv.org/abs/2201.12886},\n "
193
+ "eprinttype = {arXiv},\n "
194
+ "eprint = {2201.12886},\n "
195
+ "biburl = {https://dblp.org/rec/journals/corr/abs-2201-12886.bib}\n}"
196
+ ),
197
+ },
198
+ nbeatsm={
199
+ "Abstract": (
200
+ "The N-BEATS_M models is a model based on a deep stack multi-layer percentrons connected"
201
+ "with doubly residual connections. The model combines a multi-step forecasting strategy "
202
+ "with projections unto piecewise functions for its generic version or polynomials and "
203
+ "harmonics for its interpretable version. [Boris N. Oreshkin, Dmitri Carpov, Nicolas "
204
+ "Chapados, Yoshua Bengio. N-BEATS: Neural basis expansion analysis for interpretable "
205
+ "time series forecasting. 8th International Conference on Learning Representations, "
206
+ "ICLR 2020.](https://arxiv.org/abs/1905.10437)"
207
+ ),
208
+ "Intended use": (
209
+ "The N-BEATS_M is an efficient univariate forecasting model specialized in monthly "
210
+ "data, that uses the multi-step forecasting strategy."
211
+ ),
212
+ "Secondary use": (
213
+ "The interpretable variant of N-BEATSi_M produces a trend and seasonality "
214
+ "decomposition."
215
+ ),
216
+ "Limitations": (
217
+ "The transferability across different frequencies has not yet been tested, it is "
218
+ "advisable to restrict the use of N-BEATS_M to monthly data were it was pre-trained."
219
+ "This model purely autorregresive, transferability of models with exogenous variables "
220
+ "is yet to be done."
221
+ ),
222
+ "Training data": (
223
+ "N-BEATS_M was trained on 48,000 monthly series from the M4 competition "
224
+ "[Spyros Makridakis, Evangelos Spiliotis, and Vassilios Assimakopoulos. The "
225
+ " M4 competition: 100,000 time series and 61 forecasting methods. International "
226
+ "Journal of Forecasting, 36(1):54–74, 2020. ISSN 0169-2070.]"
227
+ "(https://www.sciencedirect.com/science/article/pii/S0169207019301128)"
228
+ ),
229
+ "Citation Info": (
230
+ "@inproceedings{oreshkin2020nbeats,\n "
231
+ "author = {Boris N. Oreshkin and \n"
232
+ " Dmitri Carpov and \n"
233
+ " Nicolas Chapados and\n"
234
+ " Yoshua Bengio},\n "
235
+ "title = {{N-BEATS:} Neural basis expansion analysis for interpretable time series forecasting},\n "
236
+ "booktitle = {8th International Conference on Learning Representations, {ICLR} 2020},\n "
237
+ "year = {2020},\n "
238
+ "url = {https://openreview.net/forum?id=r1ecqn4YwB}\n }"
239
+ ),
240
+ },
241
+ nbeatsh={
242
+ "Abstract": (
243
+ "The N-BEATS_H models is a model based on a deep stack multi-layer percentrons connected"
244
+ "with doubly residual connections. The model combines a multi-step forecasting strategy "
245
+ "with projections unto piecewise functions for its generic version or polynomials and "
246
+ "harmonics for its interpretable version. [Boris N. Oreshkin, Dmitri Carpov, Nicolas "
247
+ "Chapados, Yoshua Bengio. N-BEATS: Neural basis expansion analysis for interpretable "
248
+ "time series forecasting. 8th International Conference on Learning Representations, "
249
+ "ICLR 2020.](https://arxiv.org/abs/1905.10437)"
250
+ ),
251
+ "Intended use": (
252
+ "The N-BEATS_H is an efficient univariate forecasting model specialized in hourly "
253
+ "data, that uses the multi-step forecasting strategy."
254
+ ),
255
+ "Secondary use": (
256
+ "The interpretable variant of N-BEATSi_H produces a trend and seasonality "
257
+ "decomposition."
258
+ ),
259
+ "Limitations": (
260
+ "The transferability across different frequencies has not yet been tested, it is "
261
+ "advisable to restrict the use of N-BEATS_H to hourly data were it was pre-trained."
262
+ "This model purely autorregresive, transferability of models with exogenous variables "
263
+ "is yet to be done."
264
+ ),
265
+ "Training data": (
266
+ "N-BEATS_H was trained on 414 hourly series from the M4 competition "
267
+ "[Spyros Makridakis, Evangelos Spiliotis, and Vassilios Assimakopoulos. The "
268
+ " M4 competition: 100,000 time series and 61 forecasting methods. International "
269
+ "Journal of Forecasting, 36(1):54–74, 2020. ISSN 0169-2070.]"
270
+ "(https://www.sciencedirect.com/science/article/pii/S0169207019301128)"
271
+ ),
272
+ "Citation Info": (
273
+ "@inproceedings{oreshkin2020nbeats,\n "
274
+ "author = {Boris N. Oreshkin and \n"
275
+ " Dmitri Carpov and \n"
276
+ " Nicolas Chapados and\n"
277
+ " Yoshua Bengio},\n "
278
+ "title = {{N-BEATS:} Neural basis expansion analysis for interpretable time series forecasting},\n "
279
+ "booktitle = {8th International Conference on Learning Representations, {ICLR} 2020},\n "
280
+ "year = {2020},\n "
281
+ "url = {https://openreview.net/forum?id=r1ecqn4YwB}\n }"
282
+ ),
283
+ },
284
+ nbeatsd={
285
+ "Abstract": (
286
+ "The N-BEATS_D models is a model based on a deep stack multi-layer percentrons connected"
287
+ "with doubly residual connections. The model combines a multi-step forecasting strategy "
288
+ "with projections unto piecewise functions for its generic version or polynomials and "
289
+ "harmonics for its interpretable version. [Boris N. Oreshkin, Dmitri Carpov, Nicolas "
290
+ "Chapados, Yoshua Bengio. N-BEATS: Neural basis expansion analysis for interpretable "
291
+ "time series forecasting. 8th International Conference on Learning Representations, "
292
+ "ICLR 2020.](https://arxiv.org/abs/1905.10437)"
293
+ ),
294
+ "Intended use": (
295
+ "The N-BEATS_D is an efficient univariate forecasting model specialized in hourly "
296
+ "data, that uses the multi-step forecasting strategy."
297
+ ),
298
+ "Secondary use": (
299
+ "The interpretable variant of N-BEATSi_D produces a trend and seasonality "
300
+ "decomposition."
301
+ ),
302
+ "Limitations": (
303
+ "The transferability across different frequencies has not yet been tested, it is "
304
+ "advisable to restrict the use of N-BEATS_D to daily data were it was pre-trained."
305
+ "This model purely autorregresive, transferability of models with exogenous variables "
306
+ "is yet to be done."
307
+ ),
308
+ "Training data": (
309
+ "N-BEATS_D was trained on 4,227 daily series from the M4 competition "
310
+ "[Spyros Makridakis, Evangelos Spiliotis, and Vassilios Assimakopoulos. The "
311
+ " M4 competition: 100,000 time series and 61 forecasting methods. International "
312
+ "Journal of Forecasting, 36(1):54–74, 2020. ISSN 0169-2070.]"
313
+ "(https://www.sciencedirect.com/science/article/pii/S0169207019301128)"
314
+ ),
315
+ "Citation Info": (
316
+ "@inproceedings{oreshkin2020nbeats,\n "
317
+ "author = {Boris N. Oreshkin and \n"
318
+ " Dmitri Carpov and \n"
319
+ " Nicolas Chapados and\n"
320
+ " Yoshua Bengio},\n "
321
+ "title = {{N-BEATS:} Neural basis expansion analysis for interpretable time series forecasting},\n "
322
+ "booktitle = {8th International Conference on Learning Representations, {ICLR} 2020},\n "
323
+ "year = {2020},\n "
324
+ "url = {https://openreview.net/forum?id=r1ecqn4YwB}\n }"
325
+ ),
326
+ },
327
+ nbeatsw={
328
+ "Abstract": (
329
+ "The N-BEATS_W models is a model based on a deep stack multi-layer percentrons connected"
330
+ "with doubly residual connections. The model combines a multi-step forecasting strategy "
331
+ "with projections unto piecewise functions for its generic version or polynomials and "
332
+ "harmonics for its interpretable version. [Boris N. Oreshkin, Dmitri Carpov, Nicolas "
333
+ "Chapados, Yoshua Bengio. N-BEATS: Neural basis expansion analysis for interpretable "
334
+ "time series forecasting. 8th International Conference on Learning Representations, "
335
+ "ICLR 2020.](https://arxiv.org/abs/1905.10437)"
336
+ ),
337
+ "Intended use": (
338
+ "The N-BEATS_W is an efficient univariate forecasting model specialized in weekly "
339
+ "data, that uses the multi-step forecasting strategy."
340
+ ),
341
+ "Secondary use": (
342
+ "The interpretable variant of N-BEATSi_W produces a trend and seasonality "
343
+ "decomposition."
344
+ ),
345
+ "Limitations": (
346
+ "The transferability across different frequencies has not yet been tested, it is "
347
+ "advisable to restrict the use of N-BEATS_W to weekly data were it was pre-trained."
348
+ "This model purely autorregresive, transferability of models with exogenous variables "
349
+ "is yet to be done."
350
+ ),
351
+ "Training data": (
352
+ "N-BEATS_W was trained on 359 weekly series from the M4 competition "
353
+ "[Spyros Makridakis, Evangelos Spiliotis, and Vassilios Assimakopoulos. The "
354
+ " M4 competition: 100,000 time series and 61 forecasting methods. International "
355
+ "Journal of Forecasting, 36(1):54–74, 2020. ISSN 0169-2070.]"
356
+ "(https://www.sciencedirect.com/science/article/pii/S0169207019301128)"
357
+ ),
358
+ "Citation Info": (
359
+ "@inproceedings{oreshkin2020nbeats,\n "
360
+ "author = {Boris N. Oreshkin and \n"
361
+ " Dmitri Carpov and \n"
362
+ " Nicolas Chapados and\n"
363
+ " Yoshua Bengio},\n "
364
+ "title = {{N-BEATS:} Neural basis expansion analysis for interpretable time series forecasting},\n "
365
+ "booktitle = {8th International Conference on Learning Representations, {ICLR} 2020},\n "
366
+ "year = {2020},\n "
367
+ "url = {https://openreview.net/forum?id=r1ecqn4YwB}\n }"
368
+ ),
369
+ },
370
+ nbeatsy={
371
+ "Abstract": (
372
+ "The N-BEATS_Y models is a model based on a deep stack multi-layer percentrons connected"
373
+ "with doubly residual connections. The model combines a multi-step forecasting strategy "
374
+ "with projections unto piecewise functions for its generic version or polynomials and "
375
+ "harmonics for its interpretable version. [Boris N. Oreshkin, Dmitri Carpov, Nicolas "
376
+ "Chapados, Yoshua Bengio. N-BEATS: Neural basis expansion analysis for interpretable "
377
+ "time series forecasting. 8th International Conference on Learning Representations, "
378
+ "ICLR 2020.](https://arxiv.org/abs/1905.10437)"
379
+ ),
380
+ "Intended use": (
381
+ "The N-BEATS_Y is an efficient univariate forecasting model specialized in hourly "
382
+ "data, that uses the multi-step forecasting strategy."
383
+ ),
384
+ "Secondary use": (
385
+ "The interpretable variant of N-BEATSi_Y produces a trend and seasonality "
386
+ "decomposition."
387
+ ),
388
+ "Limitations": (
389
+ "The transferability across different frequencies has not yet been tested, it is "
390
+ "advisable to restrict the use of N-BEATS_Y to yearly data were it was pre-trained."
391
+ "This model purely autorregresive, transferability of models with exogenous variables "
392
+ "is yet to be done."
393
+ ),
394
+ "Training data": (
395
+ "N-BEATS_Y was trained on 23,000 yearly series from the M4 competition "
396
+ "[Spyros Makridakis, Evangelos Spiliotis, and Vassilios Assimakopoulos. The "
397
+ " M4 competition: 100,000 time series and 61 forecasting methods. International "
398
+ "Journal of Forecasting, 36(1):54–74, 2020. ISSN 0169-2070.]"
399
+ "(https://www.sciencedirect.com/science/article/pii/S0169207019301128)"
400
+ ),
401
+ "Citation Info": (
402
+ "@inproceedings{oreshkin2020nbeats,\n "
403
+ "author = {Boris N. Oreshkin and \n"
404
+ " Dmitri Carpov and \n"
405
+ " Nicolas Chapados and\n"
406
+ " Yoshua Bengio},\n "
407
+ "title = {{N-BEATS:} Neural basis expansion analysis for interpretable time series forecasting},\n "
408
+ "booktitle = {8th International Conference on Learning Representations, {ICLR} 2020},\n "
409
+ "year = {2020},\n "
410
+ "url = {https://openreview.net/forum?id=r1ecqn4YwB}\n }"
411
+ ),
412
+ },
413
+ arima={
414
+ "Abstract": (
415
+ "The AutoARIMA model is a classic autoregressive model that automatically explores ARIMA"
416
+ "models with a step-wise algorithm using Akaike Information Criterion. It applies to "
417
+ "seasonal and non-seasonal data and has a proven record in the M3 forecasting competition. "
418
+ "An efficient open-source version of the model was only available in R but is now also "
419
+ "available in Python. [StatsForecast: Lightning fast forecasting with statistical and "
420
+ "econometric models](https://github.com/Nixtla/statsforecast)."
421
+ ),
422
+ "Intended use": (
423
+ "The AutoARIMA is an univariate forecasting model, intended to produce automatic "
424
+ "predictions for large numbers of time series."
425
+ ),
426
+ "Secondary use": (
427
+ "It is a classical model and is an almost obligated forecasting baseline."
428
+ ),
429
+ "Limitations": (
430
+ "ARIMA model uses a recurrent prediction strategy. It concatenates errors on long "
431
+ "horizon forecasting settings. It is a fairly simple model that does not model "
432
+ "non-linear relationships."
433
+ ),
434
+ "Training data": (
435
+ "The AutoARIMA is a univariate model that uses only autorregresive data from "
436
+ "the target variable."
437
+ ),
438
+ "Citation Info": (
439
+ "@article{hyndman2008auto_arima,"
440
+ "title={Automatic Time Series Forecasting: The forecast Package for R},\n"
441
+ "author={Hyndman, Rob J. and Khandakar, Yeasmin},\n"
442
+ "volume={27},\n"
443
+ "url={https://www.jstatsoft.org/index.php/jss/article/view/v027i03},\n"
444
+ "doi={10.18637/jss.v027.i03},\n"
445
+ "number={3},\n"
446
+ "journal={Journal of Statistical Software},\n"
447
+ "year={2008},\n"
448
+ "pages={1–22}\n"
449
+ "}"
450
+ ),
451
+ },
452
+ exp_smoothing={
453
+ "Abstract": (
454
+ "Exponential smoothing is a classic technique using exponential window functions, "
455
+ "and one of the most successful forecasting methods. It has a long history, the "
456
+ "name was coined by Charles C. Holt. [Holt, Charles C. (1957). Forecasting Trends "
457
+ 'and Seasonal by Exponentially Weighted Averages". Office of Naval Research '
458
+ "Memorandum.](https://www.sciencedirect.com/science/article/abs/pii/S0169207003001134)."
459
+ ),
460
+ "Intended use": (
461
+ "Simple variants of exponential smoothing can serve as an efficient baseline method."
462
+ ),
463
+ "Secondary use": (
464
+ "The exponential smoothing method can also act as a low-pass filter removing "
465
+ "high-frequency noise. "
466
+ ),
467
+ "Limitations": (
468
+ "The method can face limitations if the series show strong discontinuities, or if "
469
+ "the high-frequency components are an important part of the predicted signal."
470
+ ),
471
+ "Training data": (
472
+ "Just like the ARIMA method, exponential smoothing uses only autorregresive data "
473
+ " from the target variable."
474
+ ),
475
+ "Citation Info": (
476
+ "@article{holt1957exponential_smoothing, \n"
477
+ "title = {Forecasting seasonals and trends by exponentially weighted moving averages},\n"
478
+ "author = {Charles C. Holt},\n"
479
+ "journal = {International Journal of Forecasting},\n"
480
+ "volume = {20},\n"
481
+ "number = {1},\n"
482
+ "pages = {5-10}\n,"
483
+ "year = {2004(1957)},\n"
484
+ "issn = {0169-2070},\n"
485
+ "doi = {https://doi.org/10.1016/j.ijforecast.2003.09.015},\n"
486
+ "url = {https://www.sciencedirect.com/science/article/pii/S0169207003001134},\n"
487
+ "}"
488
+ ),
489
+ },
490
+ prophet={
491
+ "Abstract": (
492
+ "Prophet is a widely used forecasting method. Prophet is a nonlinear regression model."
493
+ ),
494
+ "Intended use": ("Prophet can serve as a baseline method."),
495
+ "Secondary use": (
496
+ "The Prophet model is also useful for time series decomposition."
497
+ ),
498
+ "Limitations": (
499
+ "The method can face limitations if the series show strong discontinuities, or if "
500
+ "the high-frequency components are an important part of the predicted signal."
501
+ ),
502
+ "Training data": (
503
+ "Just like the ARIMA method and exponential smoothing, Prophet uses only autorregresive data "
504
+ " from the target variable."
505
+ ),
506
+ "Citation Info": (
507
+ "@article{doi:10.1080/00031305.2017.1380080,\n"
508
+ "author = {Sean J. Taylor and Benjamin Letham},\n"
509
+ "title = {Forecasting at Scale},\n"
510
+ "journal = {The American Statistician},\n"
511
+ "volume = {72},\n"
512
+ "number = {1},\n"
513
+ "pages = {37-45},\n"
514
+ "year = {2018},\n"
515
+ "publisher = {Taylor & Francis},\n"
516
+ "doi = {10.1080/00031305.2017.1380080},\n"
517
+ "URL = {https://doi.org/10.1080/00031305.2017.1380080},\n"
518
+ "eprint = {https://doi.org/10.1080/00031305.2017.1380080},\n"
519
+ "}"
520
+ ),
521
+ },
522
+ )
src/nf.py ADDED
@@ -0,0 +1,211 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from itertools import chain
2
+ from pathlib import Path
3
+ from typing import List, Optional
4
+
5
+ import neuralforecast as nf
6
+ import numpy as np
7
+ import pandas as pd
8
+ import pytorch_lightning as pl
9
+ from datasetsforecast.utils import download_file
10
+ from hyperopt import hp
11
+ from neuralforecast.auto import NHITS as autoNHITS
12
+ from neuralforecast.data.tsdataset import WindowsDataset
13
+ from neuralforecast.data.tsloader import TimeSeriesLoader
14
+ from neuralforecast.models.mqnhits.mqnhits import MQNHITS
15
+ from neuralforecast.models.nhits.nhits import NHITS
16
+
17
+ # GLOBAL PARAMETERS
18
+ DEFAULT_HORIZON = 30
19
+ HYPEROPT_STEPS = 10
20
+ MAX_STEPS = 1000
21
+ N_TS_VAL = 2 * 30
22
+
23
+ MODELS = {
24
+ "Pretrained N-HiTS M4 Hourly": {
25
+ "card": "nhitsh",
26
+ "max_steps": 0,
27
+ "model": "nhits_m4_hourly",
28
+ },
29
+ "Pretrained N-HiTS M4 Hourly (Tiny)": {
30
+ "card": "nhitsh",
31
+ "max_steps": 0,
32
+ "model": "nhits_m4_hourly_tiny",
33
+ },
34
+ "Pretrained N-HiTS M4 Daily": {
35
+ "card": "nhitsd",
36
+ "max_steps": 0,
37
+ "model": "nhits_m4_daily",
38
+ },
39
+ "Pretrained N-HiTS M4 Monthly": {
40
+ "card": "nhitsm",
41
+ "max_steps": 0,
42
+ "model": "nhits_m4_monthly",
43
+ },
44
+ "Pretrained N-HiTS M4 Yearly": {
45
+ "card": "nhitsy",
46
+ "max_steps": 0,
47
+ "model": "nhits_m4_yearly",
48
+ },
49
+ "Pretrained N-BEATS M4 Hourly": {
50
+ "card": "nbeatsh",
51
+ "max_steps": 0,
52
+ "model": "nbeats_m4_hourly",
53
+ },
54
+ "Pretrained N-BEATS M4 Daily": {
55
+ "card": "nbeatsd",
56
+ "max_steps": 0,
57
+ "model": "nbeats_m4_daily",
58
+ },
59
+ "Pretrained N-BEATS M4 Weekly": {
60
+ "card": "nbeatsw",
61
+ "max_steps": 0,
62
+ "model": "nbeats_m4_weekly",
63
+ },
64
+ "Pretrained N-BEATS M4 Monthly": {
65
+ "card": "nbeatsm",
66
+ "max_steps": 0,
67
+ "model": "nbeats_m4_monthly",
68
+ },
69
+ "Pretrained N-BEATS M4 Yearly": {
70
+ "card": "nbeatsy",
71
+ "max_steps": 0,
72
+ "model": "nbeats_m4_yearly",
73
+ },
74
+ }
75
+
76
+
77
+ def download_models():
78
+ for _, meta in MODELS.items():
79
+ if not Path(f'./models/{meta["model"]}.ckpt').is_file():
80
+ download_file(
81
+ "./models/",
82
+ f'https://nixtla-public.s3.amazonaws.com/transfer/pretrained_models/{meta["model"]}.ckpt',
83
+ )
84
+
85
+
86
+ download_models()
87
+
88
+
89
+ class StandardScaler:
90
+ """This class helps to standardize a dataframe with multiple time series."""
91
+
92
+ def __init__(self):
93
+ self.norm: pd.DataFrame
94
+
95
+ def fit(self, X: pd.DataFrame) -> "StandardScaler":
96
+ self.norm = X.groupby("unique_id").agg({"y": [np.mean, np.std]})
97
+ self.norm = self.norm.droplevel(0, 1).reset_index()
98
+
99
+ def transform(self, X: pd.DataFrame) -> pd.DataFrame:
100
+ transformed = X.merge(self.norm, how="left", on=["unique_id"])
101
+ transformed["y"] = (transformed["y"] - transformed["mean"]) / transformed["std"]
102
+ return transformed[["unique_id", "ds", "y"]]
103
+
104
+ def inverse_transform(self, X: pd.DataFrame, cols: List[str]) -> pd.DataFrame:
105
+ transformed = X.merge(self.norm, how="left", on=["unique_id"])
106
+ for col in cols:
107
+ transformed[col] = (
108
+ transformed[col] * transformed["std"] + transformed["mean"]
109
+ )
110
+ return transformed[["unique_id", "ds"] + cols]
111
+
112
+
113
+ def compute_ds_future(Y_df, fh):
114
+ if Y_df["unique_id"].nunique() == 1:
115
+ ds_ = pd.to_datetime(Y_df["ds"].values)
116
+ try:
117
+ freq = pd.infer_freq(ds_)
118
+ except:
119
+ freq = None
120
+ if freq is not None:
121
+ ds_future = pd.date_range(ds_[-1], periods=fh + 1, freq=freq)[1:]
122
+ else:
123
+ freq = ds_[-1] - ds_[-2]
124
+ ds_future = [ds_[-1] + (i + 1) * freq for i in range(fh)]
125
+ ds_future = list(map(str, ds_future))
126
+ return ds_future
127
+ else:
128
+ ds_future = chain(
129
+ *[compute_ds_future(df, fh) for _, df in Y_df.groupby("unique_id")]
130
+ )
131
+ return list(ds_future)
132
+
133
+
134
+ def forecast_pretrained_model(
135
+ Y_df: pd.DataFrame, model: str, fh: int, max_steps: int = 0
136
+ ):
137
+ if "unique_id" not in Y_df:
138
+ Y_df.insert(0, "unique_id", "ts_1")
139
+
140
+ scaler = StandardScaler()
141
+ scaler.fit(Y_df)
142
+ Y_df = scaler.transform(Y_df)
143
+
144
+ # Model
145
+ file_ = f"./models/{model}.ckpt"
146
+ mqnhits = MQNHITS.load_from_checkpoint(file_)
147
+
148
+ # Fit
149
+ if max_steps > 0:
150
+ train_dataset = WindowsDataset(
151
+ Y_df=Y_df,
152
+ X_df=None,
153
+ S_df=None,
154
+ mask_df=None,
155
+ f_cols=[],
156
+ input_size=mqnhits.n_time_in,
157
+ output_size=mqnhits.n_time_out,
158
+ sample_freq=1,
159
+ complete_windows=True,
160
+ verbose=False,
161
+ )
162
+
163
+ train_loader = TimeSeriesLoader(
164
+ dataset=train_dataset, batch_size=1, n_windows=32, shuffle=True
165
+ )
166
+
167
+ trainer = pl.Trainer(
168
+ max_epochs=None,
169
+ checkpoint_callback=False,
170
+ logger=False,
171
+ max_steps=max_steps,
172
+ gradient_clip_val=1.0,
173
+ progress_bar_refresh_rate=1,
174
+ log_every_n_steps=1,
175
+ )
176
+
177
+ trainer.fit(mqnhits, train_loader)
178
+
179
+ # Forecast
180
+ forecast_df = mqnhits.forecast(Y_df=Y_df)
181
+ forecast_df = scaler.inverse_transform(forecast_df, cols=["y_5", "y_50", "y_95"])
182
+
183
+ # Foreoast
184
+ n_ts = forecast_df["unique_id"].nunique()
185
+ if fh * n_ts > len(forecast_df):
186
+ forecast_df = (
187
+ forecast_df.groupby("unique_id")
188
+ .apply(lambda df: pd.concat([df] * fh).head(fh))
189
+ .reset_index(drop=True)
190
+ )
191
+ else:
192
+ forecast_df = forecast_df.groupby("unique_id").head(fh)
193
+ forecast_df["ds"] = compute_ds_future(Y_df, fh)
194
+
195
+ return forecast_df
196
+
197
+
198
+ if __name__ == "__main__":
199
+ df = pd.read_csv(
200
+ "https://raw.githubusercontent.com/Nixtla/transfer-learning-time-series/main/datasets/ercot_COAST.csv"
201
+ )
202
+ df.columns = ["ds", "y"]
203
+ multi_df = pd.concat([df.assign(unique_id=f"ts{i}") for i in range(2)])
204
+ assert len(compute_ds_future(multi_df, 80)) == 2 * 80
205
+ for _, meta in MODELS.items():
206
+ # test just a time series (without unique_id)
207
+ forecast = forecast_pretrained_model(df, model=meta["model"], fh=80)
208
+ assert forecast.shape == (80, 5)
209
+ # test multiple time series
210
+ multi_forecast = forecast_pretrained_model(multi_df, model=meta["model"], fh=80)
211
+ assert multi_forecast.shape == (80 * 2, 5)
src/st_deploy.py ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import sys
3
+
4
+ from streamlit.web import cli
5
+
6
+ if __name__ == "__main__":
7
+ sys.argv = [
8
+ "streamlit",
9
+ "run",
10
+ f"{os.path.dirname(os.path.realpath(__file__))}/st_app.py",
11
+ "--server.port=8501",
12
+ "--server.address=0.0.0.0",
13
+ "--server.baseUrlPath=transfer-learning",
14
+ "--logger.level=debug",
15
+ ]
16
+ sys.exit(cli.main())