兼容solarEnergy

This commit is contained in:
czzhangheng 2025-11-20 11:28:58 +08:00
parent a9e7cd5d3b
commit 9911caa3d8
4 changed files with 86 additions and 0 deletions

8
.vscode/launch.json vendored
View File

@ -44,6 +44,14 @@
"console": "integratedTerminal",
"args": "--config ./config/REPST/METR-LA.yaml"
},
{
"name": "REPST-Solar",
"type": "debugpy",
"request": "launch",
"program": "run.py",
"console": "integratedTerminal",
"args": "--config ./config/REPST/SolarEnergy.yaml"
},
{
"name": "AEPSA-PEMSBAY",
"type": "debugpy",

60
config/REPST/SolarEnergy.yaml Executable file
View File

@ -0,0 +1,60 @@
basic:
dataset: "SolarEnergy"
mode : "train"
device : "cuda:1"
model: "REPST"
seed: 2023
data:
add_day_in_week: false
add_time_in_day: false
column_wise: false
days_per_week: 7
default_graph: true
horizon: 12
lag: 12
normalizer: std
num_nodes: 137
steps_per_day: 288
test_ratio: 0.2
tod: false
val_ratio: 0.2
sample: 1
input_dim: 1
batch_size: 16
model:
pred_len: 12
seq_len: 12
patch_len: 6
stride: 7
dropout: 0.2
gpt_layers: 9
d_ff: 128
gpt_path: ./GPT-2
d_model: 64
n_heads: 1
input_dim: 1
word_num: 1000
train:
batch_size: 16
early_stop: true
early_stop_patience: 15
epochs: 100
grad_norm: false
loss_func: mae
lr_decay: true
lr_decay_rate: 0.3
lr_decay_step: "5,20,40,70"
lr_init: 0.003
max_grad_norm: 5
real_value: true
weight_decay: 0
debug: false
output_dim: 1
log_step: 1000
plot: false
mae_thresh: None
mape_thresh: 0.001

View File

@ -15,6 +15,9 @@ def load_st_dataset(config):
data_path = os.path.join("./data/METR-LA/METR-LA.h5")
with h5py.File(data_path, 'r') as f:
data = f['df']['block0_values'][:]
case "SolarEnergy":
data_path = os.path.join("./data/SolarEnergy/SolarEnergy.csv")
data = np.loadtxt(data_path, delimiter=",")
case "PEMSD3":
data_path = os.path.join("./data/PEMS03/PEMS03.npz")
data = np.load(data_path)["data"][:, :, 0]

View File

@ -50,6 +50,9 @@ def check_and_download_data():
],
"METR-LA": [
"METR-LA.h5"
],
"SolarEnergy": [
]
}
@ -96,6 +99,7 @@ def check_and_download_data():
download_kaggle_data(current_dir, 'elmahy/pems-dataset')
download_kaggle_data(current_dir, 'scchuy/pemsbay')
download_kaggle_data(current_dir, "annnnguyen/metr-la-dataset")
download_kaggle_data(current_dir, "wangshaoqi/solar-energy")
rearrange_dir()
@ -207,6 +211,17 @@ def rearrange_dir():
destination_path = os.path.join(metrla_dir, item)
shutil.move(source_path, destination_path)
# solar-energy
solar_src = os.path.join(data_dir, "solar-energy")
solar_sub = os.path.join(solar_src, "solar_AL.txt")
solar_csv = os.path.join(solar_src, "solar_AL.csv")
solar_dst_dir = os.path.join(data_dir,"SolarEnergy")
solar_dst_csv = os.path.join(solar_dst_dir, "SolarEnergy.csv")
if os.path.isdir(solar_sub): shutil.rmtree(solar_sub)
if os.path.isdir(solar_src): os.rename(solar_src, solar_dst_dir)
if os.path.isfile(solar_csv.replace(solar_src, solar_dst_dir)):
os.rename(solar_csv.replace(solar_src, solar_dst_dir), solar_dst_csv)
# 主程序
if __name__ == "__main__":