diff --git a/config/TWDGCN/AirQuality.yaml b/config/TWDGCN/AirQuality.yaml index b57aa40..97f31a1 100644 --- a/config/TWDGCN/AirQuality.yaml +++ b/config/TWDGCN/AirQuality.yaml @@ -5,11 +5,11 @@ basic: model: TWDGCN seed: 2023 data: - batch_size: 16 + batch_size: 64 column_wise: false days_per_week: 7 horizon: 24 - input_dim: 6 + input_dim: 1 lag: 24 normalizer: std num_nodes: 35 @@ -19,14 +19,16 @@ data: model: cheb_order: 2 embed_dim: 12 - input_dim: 6 + horizon: 24 + input_dim: 1 num_layers: 1 - output_dim: 6 + num_nodes: 35 + output_dim: 1 rnn_units: 64 use_day: true use_week: false train: - batch_size: 16 + batch_size: 64 debug: false early_stop: true early_stop_patience: 15 @@ -38,10 +40,10 @@ train: lr_decay_rate: 0.3 lr_decay_step: 5,20,40,70 lr_init: 0.003 - mae_thresh: '' + mae_thresh: 0.001 mape_thresh: 0.0 max_grad_norm: 5 - output_dim: 6 + output_dim: 1 plot: false real_value: true seed: 10 diff --git a/config/TWDGCN/BJTaxi-InFlow.yaml b/config/TWDGCN/BJTaxi-InFlow.yaml index 1ee9c33..cf543c8 100644 --- a/config/TWDGCN/BJTaxi-InFlow.yaml +++ b/config/TWDGCN/BJTaxi-InFlow.yaml @@ -19,8 +19,10 @@ data: model: cheb_order: 2 embed_dim: 12 + horizon: 24 input_dim: 1 num_layers: 1 + num_nodes: 1024 output_dim: 1 rnn_units: 64 use_day: true @@ -38,7 +40,7 @@ train: lr_decay_rate: 0.3 lr_decay_step: 5,20,40,70 lr_init: 0.003 - mae_thresh: '' + mae_thresh: 0.0 mape_thresh: 0.0 max_grad_norm: 5 output_dim: 1 diff --git a/config/TWDGCN/BJTaxi-OutFlow.yaml b/config/TWDGCN/BJTaxi-OutFlow.yaml index bb2933b..a9ff5f9 100644 --- a/config/TWDGCN/BJTaxi-OutFlow.yaml +++ b/config/TWDGCN/BJTaxi-OutFlow.yaml @@ -19,8 +19,10 @@ data: model: cheb_order: 2 embed_dim: 12 + horizon: 24 input_dim: 1 num_layers: 1 + num_nodes: 1024 output_dim: 1 rnn_units: 64 use_day: true @@ -38,7 +40,7 @@ train: lr_decay_rate: 0.3 lr_decay_step: 5,20,40,70 lr_init: 0.003 - mae_thresh: '' + mae_thresh: 0.0 mape_thresh: 0.0 max_grad_norm: 5 output_dim: 1 diff --git a/config/TWDGCN/Hainan.yaml b/config/TWDGCN/Hainan.yaml index d32a56b..7774f92 100755 --- a/config/TWDGCN/Hainan.yaml +++ b/config/TWDGCN/Hainan.yaml @@ -25,6 +25,7 @@ model: horizon: 12 input_dim: 1 num_layers: 1 + num_nodes: 13 output_dim: 1 rnn_units: 32 use_day: true diff --git a/config/TWDGCN/METR-LA.yaml b/config/TWDGCN/METR-LA.yaml index 42eb251..0788a9d 100644 --- a/config/TWDGCN/METR-LA.yaml +++ b/config/TWDGCN/METR-LA.yaml @@ -8,9 +8,9 @@ data: batch_size: 16 column_wise: false days_per_week: 7 - horizon: 12 + horizon: 24 input_dim: 1 - lag: 12 + lag: 24 normalizer: std num_nodes: 207 steps_per_day: 288 @@ -19,8 +19,10 @@ data: model: cheb_order: 2 embed_dim: 12 + horizon: 24 input_dim: 1 num_layers: 1 + num_nodes: 207 output_dim: 1 rnn_units: 64 use_day: true @@ -38,7 +40,7 @@ train: lr_decay_rate: 0.3 lr_decay_step: 5,20,40,70 lr_init: 0.003 - mae_thresh: '' + mae_thresh: 0.0 mape_thresh: 0.0 max_grad_norm: 5 output_dim: 1 diff --git a/config/TWDGCN/NYCBike-InFlow.yaml b/config/TWDGCN/NYCBike-InFlow.yaml index 060bdeb..af27b83 100644 --- a/config/TWDGCN/NYCBike-InFlow.yaml +++ b/config/TWDGCN/NYCBike-InFlow.yaml @@ -8,19 +8,21 @@ data: batch_size: 32 column_wise: false days_per_week: 7 - horizon: 24 + horizon: 12 input_dim: 1 - lag: 24 + lag: 12 normalizer: std - num_nodes: 1024 + num_nodes: 128 steps_per_day: 48 test_ratio: 0.2 val_ratio: 0.2 model: cheb_order: 2 embed_dim: 12 + horizon: 12 input_dim: 1 num_layers: 1 + num_nodes: 128 output_dim: 1 rnn_units: 64 use_day: true @@ -38,8 +40,8 @@ train: lr_decay_rate: 0.3 lr_decay_step: 5,20,40,70 lr_init: 0.003 - mae_thresh: '' - mape_thresh: 0.0 + mae_thresh: 0.0 + mape_thresh: 0.001 max_grad_norm: 5 output_dim: 1 plot: false diff --git a/config/TWDGCN/NYCBike-OutFlow.yaml b/config/TWDGCN/NYCBike-OutFlow.yaml index fd50df1..2b509a1 100644 --- a/config/TWDGCN/NYCBike-OutFlow.yaml +++ b/config/TWDGCN/NYCBike-OutFlow.yaml @@ -8,19 +8,21 @@ data: batch_size: 32 column_wise: false days_per_week: 7 - horizon: 24 + horizon: 12 input_dim: 1 - lag: 24 + lag: 12 normalizer: std - num_nodes: 1024 + num_nodes: 128 steps_per_day: 48 test_ratio: 0.2 val_ratio: 0.2 model: cheb_order: 2 embed_dim: 12 + horizon: 12 input_dim: 1 num_layers: 1 + num_nodes: 128 output_dim: 1 rnn_units: 64 use_day: true @@ -38,8 +40,8 @@ train: lr_decay_rate: 0.3 lr_decay_step: 5,20,40,70 lr_init: 0.003 - mae_thresh: '' - mape_thresh: 0.0 + mae_thresh: 0.0 + mape_thresh: 0.001 max_grad_norm: 5 output_dim: 1 plot: false diff --git a/config/TWDGCN/PEMSD3.yaml b/config/TWDGCN/PEMSD3.yaml index 7227a76..196970e 100755 --- a/config/TWDGCN/PEMSD3.yaml +++ b/config/TWDGCN/PEMSD3.yaml @@ -21,8 +21,10 @@ data: model: cheb_order: 2 embed_dim: 12 + horizon: 12 input_dim: 1 num_layers: 1 + num_nodes: 358 output_dim: 1 rnn_units: 64 use_day: true diff --git a/config/TWDGCN/PEMSD4.yaml b/config/TWDGCN/PEMSD4.yaml index 22d540b..c8e14a6 100755 --- a/config/TWDGCN/PEMSD4.yaml +++ b/config/TWDGCN/PEMSD4.yaml @@ -21,8 +21,10 @@ data: model: cheb_order: 2 embed_dim: 12 + horizon: 12 input_dim: 1 num_layers: 1 + num_nodes: 307 output_dim: 1 rnn_units: 64 use_day: true @@ -41,8 +43,8 @@ train: lr_decay_rate: 0.3 lr_decay_step: 5,20,40,70 lr_init: 0.003 - mae_thresh: - mape_thresh: 0.0 + mae_thresh: 0.0 + mape_thresh: 0.001 max_grad_norm: 5 output_dim: 1 plot: false diff --git a/config/TWDGCN/PEMSD7.yaml b/config/TWDGCN/PEMSD7.yaml index 6854017..2f79918 100755 --- a/config/TWDGCN/PEMSD7.yaml +++ b/config/TWDGCN/PEMSD7.yaml @@ -21,8 +21,10 @@ data: model: cheb_order: 2 embed_dim: 12 + horizon: 12 input_dim: 1 num_layers: 1 + num_nodes: 883 output_dim: 1 rnn_units: 64 use_day: true diff --git a/config/TWDGCN/PEMSD8.yaml b/config/TWDGCN/PEMSD8.yaml index 857b9eb..6dac03a 100755 --- a/config/TWDGCN/PEMSD8.yaml +++ b/config/TWDGCN/PEMSD8.yaml @@ -21,8 +21,10 @@ data: model: cheb_order: 2 embed_dim: 12 + horizon: 12 input_dim: 1 num_layers: 1 + num_nodes: 170 output_dim: 1 rnn_units: 64 use_day: true diff --git a/config/TWDGCN/SolarEnergy.yaml b/config/TWDGCN/SolarEnergy.yaml index 2403f5c..859116a 100644 --- a/config/TWDGCN/SolarEnergy.yaml +++ b/config/TWDGCN/SolarEnergy.yaml @@ -5,11 +5,11 @@ basic: model: TWDGCN seed: 2023 data: - batch_size: 16 + batch_size: 64 column_wise: false days_per_week: 7 horizon: 24 - input_dim: 137 + input_dim: 1 lag: 24 normalizer: std num_nodes: 137 @@ -19,14 +19,16 @@ data: model: cheb_order: 2 embed_dim: 12 - input_dim: 137 + horizon: 24 + input_dim: 1 num_layers: 1 - output_dim: 137 + num_nodes: 137 + output_dim: 1 rnn_units: 64 use_day: true use_week: false train: - batch_size: 16 + batch_size: 64 debug: false early_stop: true early_stop_patience: 15 @@ -38,10 +40,10 @@ train: lr_decay_rate: 0.3 lr_decay_step: 5,20,40,70 lr_init: 0.003 - mae_thresh: '' - mape_thresh: 0.0 + mae_thresh: 0.0 + mape_thresh: 0.001 max_grad_norm: 5 - output_dim: 137 + output_dim: 1 plot: false real_value: true seed: 10 diff --git a/model/TWDGCN/TWDGCN.py b/model/TWDGCN/TWDGCN.py index b360b57..bdf1186 100755 --- a/model/TWDGCN/TWDGCN.py +++ b/model/TWDGCN/TWDGCN.py @@ -89,7 +89,6 @@ class TWDGCN(nn.Module): self.num_layers = args["num_layers"] self.use_day = args["use_day"] self.use_week = args["use_week"] - self.default_graph = args["default_graph"] self.node_embeddings1 = nn.Parameter( torch.randn(self.num_node, args["embed_dim"]), requires_grad=True @@ -154,17 +153,17 @@ class TWDGCN(nn.Module): node_embedding1 = self.node_embeddings1 if self.use_day: - t_i_d_data = source[..., 1] + t_i_d_data = source[..., -2] T_i_D_emb = self.T_i_D_emb[(t_i_d_data * 288).long()] node_embedding1 = node_embedding1 * T_i_D_emb if self.use_week: - d_i_w_data = source[..., 2] + d_i_w_data = source[..., -1] D_i_W_emb = self.D_i_W_emb[d_i_w_data.long()] node_embedding1 = node_embedding1 * D_i_W_emb node_embeddings = [node_embedding1, self.node_embeddings1] - source = source[..., 0].unsqueeze(-1) + source = source[..., 0:self.input_dim] init_state1 = self.encoder1.init_hidden(source.shape[0]) output, _ = self.encoder1(source, init_state1, node_embeddings)