-
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'WenjieDu:main' into main
- Loading branch information
Showing
13 changed files
with
1,531 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,10 +5,7 @@ | |
# Created by Wenjie Du <[email protected]> | ||
# License: BSD-3-Clause | ||
|
||
from pypots.data.saving import save_dict_into_h5 | ||
from pypots.utils.random import set_random_seed | ||
|
||
from benchpots.preprocessing import ( | ||
from benchpots.datasets import ( | ||
preprocess_physionet2012, | ||
preprocess_physionet2019, | ||
preprocess_beijing_air_quality, | ||
|
@@ -18,39 +15,19 @@ | |
preprocess_pems_traffic, | ||
preprocess_ucr_uea_datasets, | ||
) | ||
from pypots.utils.random import set_random_seed | ||
|
||
|
||
def organize_and_save(data_dict, saving_dir): | ||
train = { | ||
"X": data_dict["train_X"], | ||
"X_ori": data_dict["train_X_ori"] if "train_X_ori" in data_dict.keys() else "", | ||
"y": data_dict["train_y"] if "train_y" in data_dict.keys() else "", | ||
} | ||
val = { | ||
"X": data_dict["val_X"], | ||
"X_ori": data_dict["val_X_ori"], | ||
"y": data_dict["val_y"] if "val_y" in data_dict.keys() else "", | ||
} | ||
test = { | ||
"X": data_dict["test_X"], | ||
"X_ori": data_dict["test_X_ori"], | ||
"y": data_dict["test_y"] if "test_y" in data_dict.keys() else "", | ||
} | ||
save_dict_into_h5(train, saving_dir, "train.h5") | ||
save_dict_into_h5(val, saving_dir, "val.h5") | ||
save_dict_into_h5(test, saving_dir, "test.h5") | ||
print("\n\n\n") | ||
|
||
from utils import organize_and_save | ||
|
||
if __name__ == "__main__": | ||
set_random_seed(2024) | ||
rate = 0.1 | ||
pattern = "point" | ||
|
||
physionet_2012 = preprocess_physionet2012( | ||
subset="set-a", | ||
rate=rate, | ||
pattern="point", | ||
subset="set-a", | ||
features=[ | ||
"DiasABP", | ||
"HR", | ||
|
@@ -93,7 +70,9 @@ def organize_and_save(data_dict, saving_dir): | |
|
||
step = 24 | ||
beijing_air_quality = preprocess_beijing_air_quality( | ||
rate=rate, n_steps=step, pattern=pattern | ||
rate=rate, | ||
n_steps=step, | ||
pattern=pattern, | ||
) | ||
organize_and_save( | ||
beijing_air_quality, | ||
|
@@ -102,7 +81,9 @@ def organize_and_save(data_dict, saving_dir): | |
|
||
step = 12 | ||
italy_air_quality = preprocess_italy_air_quality( | ||
rate=rate, n_steps=step, pattern=pattern | ||
rate=rate, | ||
n_steps=step, | ||
pattern=pattern, | ||
) | ||
organize_and_save( | ||
italy_air_quality, | ||
|
@@ -122,7 +103,7 @@ def organize_and_save(data_dict, saving_dir): | |
|
||
step = 48 | ||
ett = preprocess_ett( | ||
set_name="ETTh1", | ||
subset="ETTh1", | ||
rate=rate, | ||
n_steps=step, | ||
pattern=pattern, | ||
|
@@ -145,7 +126,7 @@ def organize_and_save(data_dict, saving_dir): | |
|
||
step = 24 | ||
melbourne_pedestrian = preprocess_ucr_uea_datasets( | ||
"ucr_uea_MelbournePedestrian", | ||
dataset_name="ucr_uea_MelbournePedestrian", | ||
rate=rate, | ||
) | ||
organize_and_save( | ||
|
@@ -154,7 +135,9 @@ def organize_and_save(data_dict, saving_dir): | |
) | ||
|
||
physionet_2019 = preprocess_physionet2019( | ||
rate=rate, pattern="point", subset="training_setA" | ||
subset="training_setA", | ||
rate=rate, | ||
pattern="point", | ||
) | ||
organize_and_save( | ||
physionet_2019, "generated_datasets/physionet_2019_rate01_step48_point" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,17 +5,17 @@ | |
# Created by Wenjie Du <[email protected]> | ||
# License: BSD-3-Clause | ||
|
||
from pypots.utils.random import set_random_seed | ||
|
||
from benchpots.preprocessing import ( | ||
from benchpots.datasets import ( | ||
preprocess_beijing_air_quality, | ||
preprocess_italy_air_quality, | ||
preprocess_electricity_load_diagrams, | ||
preprocess_ett, | ||
preprocess_pems_traffic, | ||
preprocess_ucr_uea_datasets, | ||
) | ||
from dataset_generating_point01 import organize_and_save | ||
from pypots.utils.random import set_random_seed | ||
|
||
from utils import organize_and_save | ||
|
||
if __name__ == "__main__": | ||
set_random_seed(2024) | ||
|
@@ -53,7 +53,7 @@ | |
|
||
step = 48 | ||
ett = preprocess_ett( | ||
set_name="ETTh1", | ||
subset="ETTh1", | ||
rate=rate, | ||
n_steps=step, | ||
pattern=pattern, | ||
|
@@ -76,7 +76,7 @@ | |
|
||
step = 24 | ||
melbourne_pedestrian = preprocess_ucr_uea_datasets( | ||
"ucr_uea_MelbournePedestrian", | ||
dataset_name="ucr_uea_MelbournePedestrian", | ||
rate=rate, | ||
) | ||
organize_and_save( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,17 +5,17 @@ | |
# Created by Wenjie Du <[email protected]> | ||
# License: BSD-3-Clause | ||
|
||
from pypots.utils.random import set_random_seed | ||
|
||
from benchpots.preprocessing import ( | ||
from benchpots.datasets import ( | ||
preprocess_beijing_air_quality, | ||
preprocess_italy_air_quality, | ||
preprocess_electricity_load_diagrams, | ||
preprocess_ett, | ||
preprocess_pems_traffic, | ||
preprocess_ucr_uea_datasets, | ||
) | ||
from dataset_generating_point01 import organize_and_save | ||
from pypots.utils.random import set_random_seed | ||
|
||
from utils import organize_and_save | ||
|
||
if __name__ == "__main__": | ||
set_random_seed(2024) | ||
|
@@ -24,7 +24,9 @@ | |
|
||
step = 24 | ||
beijing_air_quality = preprocess_beijing_air_quality( | ||
rate=rate, n_steps=step, pattern=pattern | ||
rate=rate, | ||
n_steps=step, | ||
pattern=pattern, | ||
) | ||
organize_and_save( | ||
beijing_air_quality, | ||
|
@@ -33,7 +35,9 @@ | |
|
||
step = 12 | ||
italy_air_quality = preprocess_italy_air_quality( | ||
rate=rate, n_steps=step, pattern=pattern | ||
rate=rate, | ||
n_steps=step, | ||
pattern=pattern, | ||
) | ||
organize_and_save( | ||
italy_air_quality, | ||
|
@@ -53,7 +57,7 @@ | |
|
||
step = 48 | ||
ett = preprocess_ett( | ||
set_name="ETTh1", | ||
subset="ETTh1", | ||
rate=rate, | ||
n_steps=step, | ||
pattern=pattern, | ||
|
@@ -76,7 +80,7 @@ | |
|
||
step = 24 | ||
melbourne_pedestrian = preprocess_ucr_uea_datasets( | ||
"ucr_uea_MelbournePedestrian", | ||
dataset_name="ucr_uea_MelbournePedestrian", | ||
rate=rate, | ||
) | ||
organize_and_save( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
""" | ||
""" | ||
|
||
# Created by Wenjie Du <[email protected]> | ||
# License: BSD-3-Clause | ||
|
||
from pypots.data.saving import save_dict_into_h5 | ||
|
||
|
||
def organize_and_save(data_dict, saving_dir): | ||
train = { | ||
"X": data_dict["train_X"], | ||
"X_ori": data_dict["train_X_ori"] if "train_X_ori" in data_dict.keys() else "", | ||
"y": data_dict["train_y"] if "train_y" in data_dict.keys() else "", | ||
} | ||
val = { | ||
"X": data_dict["val_X"], | ||
"X_ori": data_dict["val_X_ori"], | ||
"y": data_dict["val_y"] if "val_y" in data_dict.keys() else "", | ||
} | ||
test = { | ||
"X": data_dict["test_X"], | ||
"X_ori": data_dict["test_X_ori"], | ||
"y": data_dict["test_y"] if "test_y" in data_dict.keys() else "", | ||
} | ||
save_dict_into_h5(train, saving_dir, "train.h5") | ||
save_dict_into_h5(val, saving_dir, "val.h5") | ||
save_dict_into_h5(test, saving_dir, "test.h5") | ||
print("\n\n\n") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.