Skip to content

Commit cbe5c06

Browse files
committed
put julia run script in synthetic/irfflow/
1 parent 1835c46 commit cbe5c06

File tree

2 files changed

+259
-1
lines changed
  • example

2 files changed

+259
-1
lines changed
Lines changed: 258 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,258 @@
1+
include(joinpath(@__DIR__, "../../julia_env/evaluation.jl"))
2+
3+
n_sample_eval = 64
4+
5+
# run tv evaluation
6+
for name in ["Banana", "Funnel", "WarpedGaussian", "Cross"]
7+
for flowtype in [MF.DeterministicMixFlow, MF.BackwardIRFMixFlow, MF.IRFMixFlow]
8+
for kernel in [MF.HMC]
9+
for flowlength in [300]
10+
for step_size in [0.01, 0.05, 0.1, 0.2]
11+
for nchains in [30]
12+
for seed in 1:32
13+
14+
# run simulation
15+
df = run_tv_sweep(seed, name, flowtype, kernel, flowlength, step_size; nsample=n_sample_eval, nchains=nchains)
16+
17+
# save simulation results
18+
res_dir = joinpath(@__DIR__, "csvs/")
19+
if !isdir(res_dir)
20+
mkpath(res_dir)
21+
end
22+
23+
CSV.write(
24+
joinpath(res_dir, "$(name)_$(kernel)_$(flowtype)_$(flowlength)_$(step_size)_$(seed).csv"),
25+
df,
26+
)
27+
28+
end
29+
end
30+
end
31+
end
32+
end
33+
end
34+
end
35+
for name in ["Banana", "Funnel", "WarpedGaussian", "Cross"]
36+
for flowtype in [MF.EnsembleIRFFlow]
37+
for kernel in [MF.HMC]
38+
for flowlength in [0, 10, 20, 50, 80, 100, 200, 300]
39+
for step_size in [0.01, 0.05, 0.1, 0.2]
40+
for nchains in [30]
41+
for seed in 1:32
42+
43+
# run simulation
44+
df = run_tv_sweep(seed, name, flowtype, kernel, flowlength, step_size; nsample=n_sample_eval, nchains=nchains)
45+
46+
# save simulation results
47+
res_dir = joinpath(@__DIR__, "csvs/")
48+
if !isdir(res_dir)
49+
mkpath(res_dir)
50+
end
51+
52+
CSV.write(
53+
joinpath(res_dir, "$(name)_$(kernel)_$(flowtype)_$(flowlength)_$(step_size)_$(seed).csv"),
54+
df,
55+
)
56+
57+
end
58+
end
59+
end
60+
end
61+
end
62+
end
63+
end
64+
65+
66+
for name in ["Banana", "Funnel", "WarpedGaussian", "Cross"]
67+
for flowtype in [MF.DeterministicMixFlow, MF.BackwardIRFMixFlow, MF.IRFMixFlow]
68+
for kernel in [MF.MALA]
69+
for flowlength in [2000]
70+
for step_size in [0.05, 0.2, 1.0]
71+
for nchains in [30]
72+
for seed in 1:32
73+
74+
# run simulation
75+
df = run_tv_sweep(seed, name, flowtype, kernel, flowlength, step_size; nsample=n_sample_eval, nchains=nchains)
76+
77+
# save simulation results
78+
res_dir = joinpath(@__DIR__, "csvs/")
79+
if !isdir(res_dir)
80+
mkpath(res_dir)
81+
end
82+
83+
CSV.write(
84+
joinpath(res_dir, "$(name)_$(kernel)_$(flowtype)_$(flowlength)_$(step_size)_$(seed).csv"),
85+
df,
86+
)
87+
88+
end
89+
end
90+
end
91+
end
92+
end
93+
end
94+
end
95+
for name in ["Banana", "Funnel", "WarpedGaussian", "Cross"]
96+
for flowtype in [MF.EnsembleIRFFlow]
97+
for kernel in [MF.MALA]
98+
for flowlength in [0, 10, 20, 50, 80, 100, 200, 300]
99+
for step_size in [0.05, 0.2, 1.0]
100+
for nchains in [30]
101+
for seed in 1:32
102+
103+
# run simulation
104+
df = run_tv_sweep(seed, name, flowtype, kernel, flowlength, step_size; nsample=n_sample_eval, nchains=nchains)
105+
106+
# save simulation results
107+
res_dir = joinpath(@__DIR__, "csvs/")
108+
if !isdir(res_dir)
109+
mkpath(res_dir)
110+
end
111+
112+
CSV.write(
113+
joinpath(res_dir, "$(name)_$(kernel)_$(flowtype)_$(flowlength)_$(step_size)_$(seed).csv"),
114+
df,
115+
)
116+
117+
end
118+
end
119+
end
120+
end
121+
end
122+
end
123+
end
124+
125+
126+
for name in ["Banana", "Funnel", "WarpedGaussian", "Cross"]
127+
for flowtype in [MF.DeterministicMixFlow, MF.BackwardIRFMixFlow, MF.IRFMixFlow]
128+
for kernel in [MF.RWMH]
129+
for flowlength in [4000]
130+
for step_size in [0.05, 0.2, 1.0]
131+
for nchains in [30]
132+
for seed in 1:32
133+
134+
# run simulation
135+
df = run_tv_sweep(seed, name, flowtype, kernel, flowlength, step_size; nsample=n_sample_eval, nchains=nchains)
136+
137+
# save simulation results
138+
res_dir = joinpath(@__DIR__, "csvs/")
139+
if !isdir(res_dir)
140+
mkpath(res_dir)
141+
end
142+
143+
CSV.write(
144+
joinpath(res_dir, "$(name)_$(kernel)_$(flowtype)_$(flowlength)_$(step_size)_$(seed).csv"),
145+
df,
146+
)
147+
148+
end
149+
end
150+
end
151+
end
152+
end
153+
end
154+
end
155+
156+
157+
for name in ["Banana", "Funnel", "WarpedGaussian", "Cross"]
158+
for flowtype in [MF.EnsembleIRFFlow]
159+
for kernel in [MF.RWMH]
160+
for flowlength in [0, 10, 20, 50, 80, 100, 200, 300]
161+
for step_size in [0.05, 0.2, 1.0]
162+
for nchains in [30]
163+
for seed in 1:32
164+
165+
# run simulation
166+
df = run_tv_sweep(seed, name, flowtype, kernel, flowlength, step_size; nsample=n_sample_eval, nchains=nchains)
167+
168+
# save simulation results
169+
res_dir = joinpath(@__DIR__, "csvs/")
170+
if !isdir(res_dir)
171+
mkpath(res_dir)
172+
end
173+
174+
CSV.write(
175+
joinpath(res_dir, "$(name)_$(kernel)_$(flowtype)_$(flowlength)_$(step_size)_$(seed).csv"),
176+
df,
177+
)
178+
179+
end
180+
end
181+
end
182+
end
183+
end
184+
end
185+
end
186+
187+
188+
# get elbo, ess, logz results
189+
for name in ["Banana", "Funnel", "WarpedGaussian", "Cross"]
190+
for flowtype in [MF.DeterministicMixFlow, MF.BackwardIRFMixFlow, MF.EnsembleIRFFlow, MF.IRFMixFlow]
191+
for kernel in [MF.RWMH]
192+
for flow_length in [4000]
193+
for step_size in [1.0]
194+
for nchains in [30]
195+
for seed in 1:32
196+
197+
if flowtype == MF.EnsembleIRFFlow
198+
flowlength = 3000
199+
end
200+
# run simulation
201+
202+
df, _ = flow_evaluation(
203+
seed, name, flowtype, kernel, flow_length, step_size;
204+
nsample=n_sample_eval, nchains=nchains,
205+
track_cost=false,
206+
)
207+
208+
# save simulation results
209+
res_dir = joinpath(@__DIR__, "elbos/")
210+
if !isdir(res_dir)
211+
mkpath(res_dir)
212+
end
213+
214+
CSV.write(
215+
joinpath(res_dir, "$(name)_$(kernel)_$(flowtype)_$(flowlength)_$(step_size)_$(seed).csv"),
216+
df,
217+
)
218+
219+
end
220+
end
221+
end
222+
end
223+
end
224+
225+
for kernel in [MF.HMC]
226+
for flow_length in [200]
227+
for step_size in [0.1, 0.2]
228+
for nchains in [30]
229+
for seed in 1:32
230+
231+
# run simulation
232+
233+
df, _ = flow_evaluation(
234+
seed, name, flowtype, kernel, flow_length, step_size;
235+
nsample=n_sample_eval, nchains=nchains,
236+
track_cost=false,
237+
)
238+
239+
# save simulation results
240+
res_dir = joinpath(@__DIR__, "elbos/")
241+
if !isdir(res_dir)
242+
mkpath(res_dir)
243+
end
244+
245+
CSV.write(
246+
joinpath(res_dir, "$(name)_$(kernel)_$(flowtype)_$(flowlength)_$(step_size)_$(seed).csv"),
247+
df,
248+
)
249+
250+
end
251+
end
252+
end
253+
end
254+
end
255+
end
256+
end
257+
258+

example/synthetic_tuning/tv.nf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def plot_script = file(moduleDir/'plotting.jl')
1313
def variables = [
1414
seed: 1..32,
1515
target: ["Banana", "Cross", "Funnel", "WarpedGaussian"],
16-
flowtype: ["MF.IRFMixFlow"],
16+
flowtype: ["MF.DeterministicMixFlow", "MF.BackwardIRFMixFlow", "MF.IRFMixFlow"],
1717
kernel: ["MF.RWMH"],
1818
step_size: [0.05, 0.2, 1.0],
1919
flow_length: [4000],

0 commit comments

Comments
 (0)