-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbigtable_analysis.py
More file actions
63 lines (54 loc) · 3.26 KB
/
bigtable_analysis.py
File metadata and controls
63 lines (54 loc) · 3.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
from data_utils import Preprocessor
import pandas as pd
import numpy as np
import os
if __name__ == "__main__":
datasets = ["AustraliaTourism", "MetroTraffic", "BeijingAirQuality", "RossmanSales", "PanamaEnergy"]
levels = ['C', 'M', 'F']
bigtable = pd.DataFrame(
columns=['Dataset', 'Method', 'Level', 'Avg. MSE', 'Std. MSE'])
for dataset in datasets:
preprocessor = Preprocessor(dataset, False)
for level in levels:
for method in ["TimeGAN", "SSSD", "TimeAutoDiff", "TimeWeaver", "TSDiff-0", "TSDiff-0.5", "TSDiff-1.0", "TSDiff-2.0", "Pipe-1", "Pipe-8", "Pipe-16", "Pipe-32"]:
df_real = pd.read_csv(f"generated/{dataset}/{level}/real.csv").drop(columns=['Unnamed: 0'])
df_real_cleaned = preprocessor.cleanDataset(dataset, df_real)
non_hier_cols = [col for col in df_real_cleaned.columns if
col not in preprocessor.hierarchical_features_cyclic]
df_real_cleaned_selected = df_real_cleaned[non_hier_cols]
mses = []
for trial in range(5):
df_synth = None
if "TSDiff" in method:
strength = float(method.split('-')[1])
df_synth = pd.read_csv(
f'generated/{dataset}/{level}/synth_tsdiff_strength_{strength}_trial_{trial}.csv')
elif "Pipe" in method:
stride = int(method.split('-')[1])
df_synth = pd.read_csv(
f'generated/{dataset}/{level}/synth_wavestitch_pipeline_stride_{stride}_trial_{trial}_cycStd_grad_simplecoeff.csv')
elif method == "TimeWeaver":
df_synth = pd.read_csv(
f'generated/{dataset}/{level}/synth_timeweaver_trial_{trial}_cycStd.csv')
elif method == "TimeGAN":
df_synth = pd.read_csv(f'generated/{dataset}/{level}/synth_timegan_trial_{trial}_cycStd.csv')
elif method == "SSSD":
df_synth = pd.read_csv(f'generated/{dataset}/{level}/synth_sssd_signalconditioned_trial_{trial}.csv')
elif method == 'TimeAutoDiff':
df_synth = pd.read_csv(f'generated/{dataset}/{level}/synth_timeautodiff_trial_{trial}.csv')
df_synth = df_synth.drop(columns=['Unnamed: 0'])
df_synth_cleaned = preprocessor.cleanDataset(dataset, df_synth)
df_synth_cleaned_selected = df_synth_cleaned[non_hier_cols]
MSE = ((df_synth_cleaned_selected - df_real_cleaned_selected) ** 2).mean().mean()
mses.append(MSE)
mses = np.array(mses)
AVG_MSE = np.mean(mses)
STD = np.std(mses)
row = {'Dataset': dataset, 'Method': method, 'Level': level, 'Avg. MSE': AVG_MSE,
'Std. MSE': STD}
bigtable.loc[len(bigtable)] = row
path = "experiments/bigtable/"
if not os.path.exists(path):
os.makedirs(path)
final_path = os.path.join(path, "bigtable_wavestitch_grad_revision.csv")
bigtable.to_csv(final_path)