-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.py
More file actions
170 lines (162 loc) · 4.67 KB
/
Copy pathconfig.py
File metadata and controls
170 lines (162 loc) · 4.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
class Config():
# Dataset identifiers — restricted to the datasets used in the paper.
# If you add more datasets, also extend periods/stride_lengths/d_model/d_ff below.
dataset_names = ["m4_h", "m4_m", "m4_y", "ett_h1", "ett_h2", "ett_m1", "ett_m2",
"weather", "exchange_rate", "illness"]
default_decomp_params = {
"decomposition_kernel_size": 5, # moving-average
"decomposition_n_bands": 6, # fourier bandlimited
"decomposition_k": 5, # fourier topk
"decomposition_wavelet": "db4", # wavelet
"decomposition_levels": 5, # wavelet, modwt
# STFD specific — paper main result setting
"stfd_window_size": 12, # w
"stfd_kernel_size": 13, # k (trend extraction)
"stfd_use_full_fft": False, # default rfft (real signal optimal)
"stfd_padding_mode": "replicate", # replicate padding (paper main result)
# # alternatives: 'none' (drops to L-w+1), 'reflect', 'cyclic'
# Other baselines
"decomposition_n_components": 4, # ewt
"decomposition_K": 5, # vmd_fixed
"decomposition_alpha": 2000, # vmd_fixed
}
default_short_dataset_decomp_params = {
"decomposition_kernel_size": 33, # moving-average
"decomposition_n_bands": 4, # fourier bandlimited
"decomposition_k": 4, # fourier topk
"decomposition_wavelet": "db1", # wavelet
"decomposition_levels": 4, # wavelet, modwt
# STFD specific (smaller window for short datasets)
"stfd_window_size": 6,
"stfd_kernel_size": 3,
"stfd_use_full_fft": False,
"stfd_padding_mode": "reflect",
# Other baselines
"decomposition_n_components": 3, # ewt
"decomposition_K": 4, # vmd_fixed
"decomposition_alpha": 2000,
}
# Metrics
metrics = ["mae", "mse", "smape", "mase", "owa"]
# Training set size
train_size = 0.6
# Validation set size
val_size = 0.2
# Input data length
backhorizon = 48
short_backhorizon = 12
# Forecasting horizon
horizon = 48
short_horizon = 12
periods = {
"cif": 1,
"nn5": 7,
"tourism": 12,
"weather_uts": 1,
"m3_m": 12,
"m3_q": 4,
"m3_y": 1,
"m3_o": 1,
"m4_h": 24,
"m4_w": 7,
"m4_y": 1,
"m4_m": 12,
"m4_d": 7,
"m4_q": 4,
"transactions": 7,
"rain": 12,
"weather": 1,
"exchange_rate": 7,
"illness": 1,
"ett_h1": 24,
"ett_h2": 24,
"ett_m1": 12,
"ett_m2": 12,
"covid": 1,
"walmart": 1,
}
# Stride length (sliding window step size) for generating train/val/test instances, varies by dataset
stride_lengths = {
"cif": 1,
"nn5": 5,
"tourism": 5,
"weather_uts": 5,
"m3_m": 1,
"m3_q": 1,
"m3_y": 1,
"m3_o": 1,
"m4_h": 5,
"m4_w": 5,
"m4_y": 5,
"m4_m": 5,
"m4_d": 5,
"m4_q": 5,
"transactions": 5,
"rain": 1,
"weather": 5,
"exchange_rate": 1,
"illness": 1,
"ett_h1": 5,
"ett_h2": 5,
"ett_m1": 5,
"ett_m2": 5,
"covid": 1,
"walmart": 1,
}
# Deep learning model parameters varying by dataset
# These parameters are taken as provided in the original authors' codebase and adapted for the other datasets
# https://github.com/thuml/Time-Series-Library/blob/main/scripts/short_term_forecast/TimesNet_M4.sh
d_model = {
"cif": 16,
"nn5": 16,
"tourism": 32,
"weather_uts": 32,
"m3_m": 32,
"m3_q": 64,
"m3_y": 64,
"m3_o": 32,
"m4_h": 32,
"m4_w": 32,
"m4_y": 64,
"m4_m": 32,
"m4_d": 32,
"m4_q": 32,
"transactions": 32,
"rain": 16,
"weather": 32,
"exchange_rate": 96,
"illness": 768,
"ett_h1": 16,
"ett_h2": 32,
"ett_m1": 64,
"ett_m2": 32,
"covid": 32,
"walmart": 32,
}
d_ff = {
"cif": 32,
"nn5": 16,
"tourism": 32,
"weather_uts": 32,
"m3_m": 32,
"m3_q": 64,
"m3_y": 64,
"m3_o": 32,
"m4_h": 32,
"m4_w": 32,
"m4_y": 64,
"m4_m": 32,
"m4_d": 32,
"m4_q": 32,
"transactions": 32,
"rain": 16,
"weather": 32,
"exchange_rate": 96,
"illness": 768,
"ett_h1": 32,
"ett_h2": 32,
"ett_m1": 64,
"ett_m2": 32,
"covid": 32,
"walmart": 32,
}