-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrepro_script_python.py
More file actions
137 lines (122 loc) · 5.16 KB
/
repro_script_python.py
File metadata and controls
137 lines (122 loc) · 5.16 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
import os
import glob
import sys
from exps.core_scaling.scaling_baselines import scaling_baselines
from exps.core_scaling.bucket_ae_scaling.bucket_action_elimination_scaling import scaling_bucket_ae, scaling_bucket_ae_plot
from exps.core_scaling.scaling_baselines_plot import scaling_baselines_plot
from exps.core_scaling.scaling_fit_plot import scaling_fit_plot
from exps.core_tradeoff.tradeoff_baselines import tradeoff_baselines, tradeoff_baselines_plot
from exps.rebuttal_exps.runtime_scaling import exp_runtime_scaling
from exps.crypto_pairs.run_crypto_pairs_scaling import run_crypto_pairs_scaling
from exps.high_dimension.run_sift_scaling import sift_scaling
from exps.high_dimension.run_song_scaling import song_scaling
from utils.constants import (
SCALING_BASELINES_ALGORITHMS,
TRADEOFF_BASELINES_ALGORITHMS,
TRADEOFF_BASELINES_DATATYPES,
ACTION_ELIMINATION,
SCALING_FIT_DATATYPES,
SCALING_BASELINES_DATATYPES,
HIGHLY_SYMMETRIC,
)
def main(experiment):
path = os.path.join(os.getcwd(), "exps")
if experiment=="main":
# figure 1: sample complexity
complexity_path = os.path.join(path, "core_scaling", "sample_complexity")
scaling_baselines([ACTION_ELIMINATION], SCALING_FIT_DATATYPES, complexity_path)
scaling_fit_plot(
algorithm=ACTION_ELIMINATION,
data_types=SCALING_FIT_DATATYPES,
dir_name=complexity_path,
save_to=os.path.join(os.getcwd(), "figures", "figure1:sample_complexities")
)
# figure 2: scaling comparisons
scaling_path = os.path.join(path, "core_scaling", "scaling_comparison")
scaling_baselines(SCALING_BASELINES_ALGORITHMS, SCALING_BASELINES_DATATYPES, scaling_path)
scaling_baselines_plot(
algorithms=SCALING_BASELINES_ALGORITHMS,
data_types=SCALING_BASELINES_DATATYPES,
dir_name=scaling_path,
save_to=os.path.join(os.getcwd(), "figures", "figure2:scaling_comparisons")
)
# figure 3: tradeoff @ precision 1
tradeoff_path = os.path.join(path, "core_tradeoff", "normalized_logs")
tradeoff_baselines(
algorithms=TRADEOFF_BASELINES_ALGORITHMS,
top_ks=[1],
data_types=TRADEOFF_BASELINES_DATATYPES,
dir_name=tradeoff_path,
)
tradeoff_baselines_plot(
algorithms=TRADEOFF_BASELINES_ALGORITHMS,
top_ks=[1],
data_types=TRADEOFF_BASELINES_DATATYPES,
dir_name=tradeoff_path,
save_to=os.path.join(os.getcwd(), "figures", "figure3:tradeoff_k1")
)
# figure 4: high-dimensional datasets
run_crypto_pairs_scaling(
run=True,
plot=True,
save_to=os.path.join(os.getcwd(), "figures", "figure4:high-dimensional")
)
sift_scaling(
run=True,
plot=True,
save_to=os.path.join(os.getcwd(), "figures", "figure4:high-dimensional")
)
elif experiment=="appendix":
# figure 5: tradeoff @ precision 5
tradeoff_path = os.path.join(path, "core_tradeoff", "normalized_logs")
tradeoff_baselines(
algorithms=TRADEOFF_BASELINES_ALGORITHMS,
top_ks=[5],
data_types=TRADEOFF_BASELINES_DATATYPES,
dir_name=tradeoff_path,
)
tradeoff_baselines_plot(
algorithms=TRADEOFF_BASELINES_ALGORITHMS,
top_ks=[5],
data_types=TRADEOFF_BASELINES_DATATYPES,
dir_name=tradeoff_path,
save_to=os.path.join(os.getcwd(), "figures", "figure5:appendix_tradeoff_k5")
)
# figure 6: tradeoff @ precision 10
tradeoff_path = os.path.join(path, "core_tradeoff", "normalized_logs")
tradeoff_baselines(
algorithms=TRADEOFF_BASELINES_ALGORITHMS,
top_ks=[10],
data_types=TRADEOFF_BASELINES_DATATYPES,
dir_name=tradeoff_path,
)
tradeoff_baselines_plot(
algorithms=TRADEOFF_BASELINES_ALGORITHMS,
top_ks=[10],
data_types=TRADEOFF_BASELINES_DATATYPES,
dir_name=tradeoff_path,
save_to=os.path.join(os.getcwd(), "figures", "figure6:appendix_tradeoff_k10")
)
# figure 7: compatibility with preprocessing + scaling with N
scaling_bucket_ae()
scaling_bucket_ae_plot()
# figure 8: simple song fit
song_scaling(
run=True,
plot=True,
save_to=os.path.join(os.getcwd(), "figures", "figure8:appendix_simple_song")
)
# figure 9: symmetric normal
complexity_path = os.path.join(path, "core_scaling", "sample_complexity")
scaling_baselines([ACTION_ELIMINATION], [HIGHLY_SYMMETRIC], complexity_path)
scaling_fit_plot(
algorithm=ACTION_ELIMINATION,
data_types=[HIGHLY_SYMMETRIC],
dir_name=complexity_path,
save_to=os.path.join(os.getcwd(), "figures", "figure9:appendix_highly-symmetric")
)
else:
raise NameError("arg should be main or appendix")
print(f"=> {experiment} figures generated!")
if __name__ == "__main__":
main(sys.argv[1])