From b57fcef039983637791e204ec10896738247101a Mon Sep 17 00:00:00 2001 From: czzhangheng Date: Tue, 9 Dec 2025 16:56:30 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9ESolarEnergy-iTransformer?= =?UTF-8?q?=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .vscode/launch.json | 18 +++++++- config/iTransformer/AirQuality.yaml | 52 ++++++++++++++++++++++++ config/iTransformer/BJTaxi-Inflow.yaml | 52 ++++++++++++++++++++++++ config/iTransformer/BJTaxi-Outflow.yaml | 52 ++++++++++++++++++++++++ config/iTransformer/METR-LA.yaml | 2 +- config/iTransformer/NYCBike-Inflow.yaml | 52 ++++++++++++++++++++++++ config/iTransformer/NYCBike-Outflow.yaml | 52 ++++++++++++++++++++++++ config/iTransformer/PEMS-BAY.yaml | 52 ++++++++++++++++++++++++ config/iTransformer/SolarEnergy.yaml | 52 ++++++++++++++++++++++++ dataloader/TSloader.py | 1 + 10 files changed, 383 insertions(+), 2 deletions(-) create mode 100644 config/iTransformer/AirQuality.yaml create mode 100644 config/iTransformer/BJTaxi-Inflow.yaml create mode 100644 config/iTransformer/BJTaxi-Outflow.yaml create mode 100644 config/iTransformer/NYCBike-Inflow.yaml create mode 100644 config/iTransformer/NYCBike-Outflow.yaml create mode 100644 config/iTransformer/PEMS-BAY.yaml create mode 100644 config/iTransformer/SolarEnergy.yaml diff --git a/.vscode/launch.json b/.vscode/launch.json index 40c72a3..21af481 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -2097,6 +2097,22 @@ "program": "run.py", "console": "integratedTerminal", "args": "--config ./config/iTransformer/METR-LA.yaml" - } + }, + { + "name": "iTransformer: AirQuality", + "type": "debugpy", + "request": "launch", + "program": "run.py", + "console": "integratedTerminal", + "args": "--config ./config/iTransformer/AirQuality.yaml" + }, + { + "name": "iTransformer: SolarEnergy", + "type": "debugpy", + "request": "launch", + "program": "run.py", + "console": "integratedTerminal", + "args": "--config ./config/iTransformer/SolarEnergy.yaml" + }, ] } \ No newline at end of file diff --git a/config/iTransformer/AirQuality.yaml b/config/iTransformer/AirQuality.yaml new file mode 100644 index 0000000..74bf69d --- /dev/null +++ b/config/iTransformer/AirQuality.yaml @@ -0,0 +1,52 @@ +basic: + dataset: AirQuality + device: cuda:0 + mode: train + model: iTransformer + seed: 2023 + +data: + batch_size: 16 + column_wise: false + days_per_week: 7 + horizon: 24 + input_dim: 6 + lag: 24 + normalizer: std + num_nodes: 35 + steps_per_day: 24 + test_ratio: 0.2 + val_ratio: 0.2 + +model: + activation: gelu + seq_len: 24 + pred_len: 24 + d_model: 128 + d_ff: 2048 + dropout: 0.1 + e_layers: 2 + n_heads: 8 + output_attention: False + + +train: + batch_size: 16 + debug: false + early_stop: true + early_stop_patience: 15 + epochs: 100 + grad_norm: false + log_step: 1000 + loss_func: mae + lr_decay: true + lr_decay_rate: 0.3 + lr_decay_step: 5,20,40,70 + lr_init: 0.0001 + mae_thresh: None + mape_thresh: 0.001 + max_grad_norm: 5 + output_dim: 35 + plot: false + real_value: true + weight_decay: 0 \ No newline at end of file diff --git a/config/iTransformer/BJTaxi-Inflow.yaml b/config/iTransformer/BJTaxi-Inflow.yaml new file mode 100644 index 0000000..8a0e7c9 --- /dev/null +++ b/config/iTransformer/BJTaxi-Inflow.yaml @@ -0,0 +1,52 @@ +basic: + dataset: BJTaxi-InFlow + device: cuda:0 + mode: train + model: iTransformer + seed: 2023 + +data: + batch_size: 32 + column_wise: false + days_per_week: 7 + horizon: 24 + input_dim: 1 + lag: 24 + normalizer: std + num_nodes: 1024 + steps_per_day: 48 + test_ratio: 0.2 + val_ratio: 0.2 + +model: + activation: gelu + seq_len: 24 + pred_len: 24 + d_model: 128 + d_ff: 2048 + dropout: 0.1 + e_layers: 2 + n_heads: 8 + output_attention: False + + +train: + batch_size: 16 + debug: false + early_stop: true + early_stop_patience: 15 + epochs: 100 + grad_norm: false + log_step: 1000 + loss_func: mae + lr_decay: true + lr_decay_rate: 0.3 + lr_decay_step: 5,20,40,70 + lr_init: 0.0001 + mae_thresh: None + mape_thresh: 0.001 + max_grad_norm: 5 + output_dim: 1024 + plot: false + real_value: true + weight_decay: 0 \ No newline at end of file diff --git a/config/iTransformer/BJTaxi-Outflow.yaml b/config/iTransformer/BJTaxi-Outflow.yaml new file mode 100644 index 0000000..ea4af50 --- /dev/null +++ b/config/iTransformer/BJTaxi-Outflow.yaml @@ -0,0 +1,52 @@ +basic: + dataset: BJTaxi-OutFlow + device: cuda:0 + mode: train + model: iTransformer + seed: 2023 + +data: + batch_size: 32 + column_wise: false + days_per_week: 7 + horizon: 24 + input_dim: 1 + lag: 24 + normalizer: std + num_nodes: 1024 + steps_per_day: 48 + test_ratio: 0.2 + val_ratio: 0.2 + +model: + activation: gelu + seq_len: 24 + pred_len: 24 + d_model: 128 + d_ff: 2048 + dropout: 0.1 + e_layers: 2 + n_heads: 8 + output_attention: False + + +train: + batch_size: 16 + debug: false + early_stop: true + early_stop_patience: 15 + epochs: 100 + grad_norm: false + log_step: 1000 + loss_func: mae + lr_decay: true + lr_decay_rate: 0.3 + lr_decay_step: 5,20,40,70 + lr_init: 0.0001 + mae_thresh: None + mape_thresh: 0.001 + max_grad_norm: 5 + output_dim: 1024 + plot: false + real_value: true + weight_decay: 0 \ No newline at end of file diff --git a/config/iTransformer/METR-LA.yaml b/config/iTransformer/METR-LA.yaml index 925c6d2..3d02d8b 100644 --- a/config/iTransformer/METR-LA.yaml +++ b/config/iTransformer/METR-LA.yaml @@ -1,6 +1,6 @@ basic: dataset: METR-LA - device: cuda:0 + device: cuda:1 mode: train model: iTransformer seed: 2023 diff --git a/config/iTransformer/NYCBike-Inflow.yaml b/config/iTransformer/NYCBike-Inflow.yaml new file mode 100644 index 0000000..598ca1e --- /dev/null +++ b/config/iTransformer/NYCBike-Inflow.yaml @@ -0,0 +1,52 @@ +basic: + dataset: NYCBike-InFlow + device: cuda:0 + mode: train + model: iTransformer + seed: 2023 + +data: + batch_size: 32 + column_wise: false + days_per_week: 7 + horizon: 24 + input_dim: 1 + lag: 24 + normalizer: std + num_nodes: 128 + steps_per_day: 48 + test_ratio: 0.2 + val_ratio: 0.2 + +model: + activation: gelu + seq_len: 24 + pred_len: 24 + d_model: 128 + d_ff: 2048 + dropout: 0.1 + e_layers: 2 + n_heads: 8 + output_attention: False + + +train: + batch_size: 16 + debug: false + early_stop: true + early_stop_patience: 15 + epochs: 100 + grad_norm: false + log_step: 1000 + loss_func: mae + lr_decay: true + lr_decay_rate: 0.3 + lr_decay_step: 5,20,40,70 + lr_init: 0.0001 + mae_thresh: None + mape_thresh: 0.001 + max_grad_norm: 5 + output_dim: 128 + plot: false + real_value: true + weight_decay: 0 \ No newline at end of file diff --git a/config/iTransformer/NYCBike-Outflow.yaml b/config/iTransformer/NYCBike-Outflow.yaml new file mode 100644 index 0000000..b6a8994 --- /dev/null +++ b/config/iTransformer/NYCBike-Outflow.yaml @@ -0,0 +1,52 @@ +basic: + dataset: NYCBike-OutFlow + device: cuda:0 + mode: train + model: iTransformer + seed: 2023 + +data: + batch_size: 32 + column_wise: false + days_per_week: 7 + horizon: 24 + input_dim: 1 + lag: 24 + normalizer: std + num_nodes: 128 + steps_per_day: 48 + test_ratio: 0.2 + val_ratio: 0.2 + +model: + activation: gelu + seq_len: 24 + pred_len: 24 + d_model: 128 + d_ff: 2048 + dropout: 0.1 + e_layers: 2 + n_heads: 8 + output_attention: False + + +train: + batch_size: 16 + debug: false + early_stop: true + early_stop_patience: 15 + epochs: 100 + grad_norm: false + log_step: 1000 + loss_func: mae + lr_decay: true + lr_decay_rate: 0.3 + lr_decay_step: 5,20,40,70 + lr_init: 0.0001 + mae_thresh: None + mape_thresh: 0.001 + max_grad_norm: 5 + output_dim: 128 + plot: false + real_value: true + weight_decay: 0 \ No newline at end of file diff --git a/config/iTransformer/PEMS-BAY.yaml b/config/iTransformer/PEMS-BAY.yaml new file mode 100644 index 0000000..5140b73 --- /dev/null +++ b/config/iTransformer/PEMS-BAY.yaml @@ -0,0 +1,52 @@ +basic: + dataset: PEMS-BAY + device: cuda:0 + mode: train + model: iTransformer + seed: 2023 + +data: + batch_size: 16 + column_wise: false + days_per_week: 7 + horizon: 24 + input_dim: 1 + lag: 24 + normalizer: std + num_nodes: 325 + steps_per_day: 288 + test_ratio: 0.2 + val_ratio: 0.2 + +model: + activation: gelu + seq_len: 24 + pred_len: 24 + d_model: 128 + d_ff: 2048 + dropout: 0.1 + e_layers: 2 + n_heads: 8 + output_attention: False + + +train: + batch_size: 16 + debug: false + early_stop: true + early_stop_patience: 15 + epochs: 100 + grad_norm: false + log_step: 1000 + loss_func: mae + lr_decay: true + lr_decay_rate: 0.3 + lr_decay_step: 5,20,40,70 + lr_init: 0.0001 + mae_thresh: None + mape_thresh: 0.001 + max_grad_norm: 5 + output_dim: 325 + plot: false + real_value: true + weight_decay: 0 \ No newline at end of file diff --git a/config/iTransformer/SolarEnergy.yaml b/config/iTransformer/SolarEnergy.yaml new file mode 100644 index 0000000..bab0108 --- /dev/null +++ b/config/iTransformer/SolarEnergy.yaml @@ -0,0 +1,52 @@ +basic: + dataset: SolarEnergy + device: cuda:0 + mode: train + model: iTransformer + seed: 2023 + +data: + batch_size: 16 + column_wise: false + days_per_week: 7 + horizon: 24 + input_dim: 6 + lag: 24 + normalizer: std + num_nodes: 137 + steps_per_day: 24 + test_ratio: 0.2 + val_ratio: 0.2 + +model: + activation: gelu + seq_len: 24 + pred_len: 24 + d_model: 128 + d_ff: 2048 + dropout: 0.1 + e_layers: 2 + n_heads: 8 + output_attention: False + + +train: + batch_size: 16 + debug: false + early_stop: true + early_stop_patience: 15 + epochs: 100 + grad_norm: false + log_step: 1000 + loss_func: mae + lr_decay: true + lr_decay_rate: 0.3 + lr_decay_step: 5,20,40,70 + lr_init: 0.0001 + mae_thresh: None + mape_thresh: 0.001 + max_grad_norm: 5 + output_dim: 137 + plot: false + real_value: true + weight_decay: 0 \ No newline at end of file diff --git a/dataloader/TSloader.py b/dataloader/TSloader.py index bd72b9a..33b5a17 100755 --- a/dataloader/TSloader.py +++ b/dataloader/TSloader.py @@ -7,6 +7,7 @@ import torch def get_dataloader(args, normalizer="std", single=True): data = load_st_dataset(args) + data = data[..., 0:1] args = args["data"] L, N, F = data.shape