Compare commits
No commits in common. "3b6dc18742e1bc14f790a4a05ef296471134dfbe" and "fe3fc186be5deee3fc0e3cb1a544f9d7085c2e67" have entirely different histories.
3b6dc18742
...
fe3fc186be
|
|
@ -36,14 +36,6 @@
|
||||||
"console": "integratedTerminal",
|
"console": "integratedTerminal",
|
||||||
"args": "--config ./config/REPST/PEMS-BAY.yaml"
|
"args": "--config ./config/REPST/PEMS-BAY.yaml"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"name": "REPST-METR",
|
|
||||||
"type": "debugpy",
|
|
||||||
"request": "launch",
|
|
||||||
"program": "run.py",
|
|
||||||
"console": "integratedTerminal",
|
|
||||||
"args": "--config ./config/REPST/METR-LA.yaml"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "AEPSA-PEMSBAY",
|
"name": "AEPSA-PEMSBAY",
|
||||||
"type": "debugpy",
|
"type": "debugpy",
|
||||||
|
|
|
||||||
|
|
@ -1,60 +0,0 @@
|
||||||
basic:
|
|
||||||
dataset: "METR-LA"
|
|
||||||
mode : "train"
|
|
||||||
device : "cuda:1"
|
|
||||||
model: "REPST"
|
|
||||||
seed: 2023
|
|
||||||
|
|
||||||
data:
|
|
||||||
add_day_in_week: true
|
|
||||||
add_time_in_day: true
|
|
||||||
column_wise: false
|
|
||||||
days_per_week: 7
|
|
||||||
default_graph: true
|
|
||||||
horizon: 12
|
|
||||||
lag: 12
|
|
||||||
normalizer: std
|
|
||||||
num_nodes: 207
|
|
||||||
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
|
|
||||||
|
|
||||||
|
|
@ -11,13 +11,11 @@ def load_st_dataset(config):
|
||||||
data_path = os.path.join("./data/PEMS-BAY/pems-bay.h5")
|
data_path = os.path.join("./data/PEMS-BAY/pems-bay.h5")
|
||||||
with h5py.File(data_path, 'r') as f:
|
with h5py.File(data_path, 'r') as f:
|
||||||
data = f['speed']['block0_values'][:]
|
data = f['speed']['block0_values'][:]
|
||||||
case "METR-LA":
|
|
||||||
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 "PEMSD3":
|
case "PEMSD3":
|
||||||
data_path = os.path.join("./data/PEMS03/PEMS03.npz")
|
data_path = os.path.join("./data/PEMS03/PEMS03.npz")
|
||||||
data = np.load(data_path)["data"][:, :, 0]
|
data = np.load(data_path)["data"][
|
||||||
|
:, :, 0
|
||||||
|
]
|
||||||
case "PEMSD4":
|
case "PEMSD4":
|
||||||
data_path = os.path.join("./data/PEMS04/PEMS04.npz")
|
data_path = os.path.join("./data/PEMS04/PEMS04.npz")
|
||||||
data = np.load(data_path)["data"][
|
data = np.load(data_path)["data"][
|
||||||
|
|
|
||||||
2
run.py
2
run.py
|
|
@ -14,8 +14,6 @@ def main():
|
||||||
args = parse_args()
|
args = parse_args()
|
||||||
args = init.init_device(args)
|
args = init.init_device(args)
|
||||||
init.init_seed(args["basic"]["seed"])
|
init.init_seed(args["basic"]["seed"])
|
||||||
|
|
||||||
|
|
||||||
model = init.init_model(args)
|
model = init.init_model(args)
|
||||||
|
|
||||||
# Load dataset
|
# Load dataset
|
||||||
|
|
|
||||||
|
|
@ -47,9 +47,6 @@ def check_and_download_data():
|
||||||
"adj_mx_bay.pkl",
|
"adj_mx_bay.pkl",
|
||||||
"pems-bay-meta.h5",
|
"pems-bay-meta.h5",
|
||||||
"pems-bay.h5"
|
"pems-bay.h5"
|
||||||
],
|
|
||||||
"METR-LA": [
|
|
||||||
"METR-LA.h5"
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -95,7 +92,6 @@ def check_and_download_data():
|
||||||
if missing_main_files:
|
if missing_main_files:
|
||||||
download_kaggle_data(current_dir, 'elmahy/pems-dataset')
|
download_kaggle_data(current_dir, 'elmahy/pems-dataset')
|
||||||
download_kaggle_data(current_dir, 'scchuy/pemsbay')
|
download_kaggle_data(current_dir, 'scchuy/pemsbay')
|
||||||
download_kaggle_data(current_dir, "annnnguyen/metr-la-dataset")
|
|
||||||
|
|
||||||
rearrange_dir()
|
rearrange_dir()
|
||||||
|
|
||||||
|
|
@ -187,6 +183,7 @@ def rearrange_dir():
|
||||||
shutil.copy2(source_path, destination_path)
|
shutil.copy2(source_path, destination_path)
|
||||||
|
|
||||||
shutil.rmtree(nested_data_dir)
|
shutil.rmtree(nested_data_dir)
|
||||||
|
# print(f"已合并 {nested_data_dir} 到 {data_dir},并删除嵌套目录。")
|
||||||
|
|
||||||
# 将带有 "bay" 的文件移动到 PEMS-BAY 文件夹
|
# 将带有 "bay" 的文件移动到 PEMS-BAY 文件夹
|
||||||
pems_bay_dir = os.path.join(data_dir, "PEMS-BAY")
|
pems_bay_dir = os.path.join(data_dir, "PEMS-BAY")
|
||||||
|
|
@ -198,16 +195,10 @@ def rearrange_dir():
|
||||||
destination_path = os.path.join(pems_bay_dir, item)
|
destination_path = os.path.join(pems_bay_dir, item)
|
||||||
shutil.move(source_path, destination_path)
|
shutil.move(source_path, destination_path)
|
||||||
|
|
||||||
# metr-la
|
# print(f"已将带有 'bay' 的文件移动到 {pems_bay_dir}。")
|
||||||
metrla_dir = os.path.join(data_dir, "METR-LA")
|
|
||||||
os.makedirs(metrla_dir, exist_ok=True)
|
|
||||||
for item in os.listdir(data_dir):
|
|
||||||
if "metr" in item.lower() and (item.endswith(".pkl") or item.endswith(".h5")):
|
|
||||||
source_path = os.path.join(data_dir, item)
|
|
||||||
destination_path = os.path.join(metrla_dir, item)
|
|
||||||
shutil.move(source_path, destination_path)
|
|
||||||
|
|
||||||
|
|
||||||
# 主程序
|
# 主程序
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
check_and_download_data()
|
check_and_download_data()
|
||||||
|
# rearrange_dir()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue