-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun_eki.jl
60 lines (44 loc) · 1.71 KB
/
run_eki.jl
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
include("setup.jl")
include("InferenceAlgorithms/InferenceAlgorithms.jl")
Ne = 1000
n_trials = 10
data_folder = "data/eki"
fnames = [
"$(data_folder)/eki_$Ne.h5",
# "$(data_folder)/eki_boot_$Ne.h5",
# "$(data_folder)/eki_boot_reg_$Ne.h5",
# "$(data_folder)/eki_shuffle_$Ne.h5",
# "$(data_folder)/eki_inflation_$Ne.h5",
# "$(data_folder)/eki_boot_inflation_$Ne.h5",
]
settings = [
(IdentityLocaliser(), IdentityInflator()),
# (BootstrapLocaliser(type=:unregularised), IdentityInflator()),
# (BootstrapLocaliser(type=:regularised), IdentityInflator()),
# (ShuffleLocaliser(), IdentityInflator()),
# (IdentityLocaliser(), AdaptiveInflator()),
# (BootstrapLocaliser(type=:unregularised), AdaptiveInflator())
]
for (fname, setting) ∈ zip(fnames, settings)
results = Dict()
for i ∈ 1:n_trials
θs, us, Fs, Gs = run_eki_dmc(
F, G, pr, d_obs, μ_e, C_e, Ne;
localiser=setting[1],
inflator=setting[2]
)
μ_post = transform(pr, mean(θs[end], dims=2))
μ_post = reshape(μ_post, grid_c.nx, grid_c.nx)
σ_post = std(us[end], dims=2)
σ_post = reshape(σ_post, grid_c.nx, grid_c.nx)
results["θs_$i"] = θs[end]
results["us_$i"] = us[end]
results["Fs_$i"] = model_r.B_wells * Fs[end]
results["ls"] = [gauss_to_unif(ω_σ, σ_bounds...) for ω_σ ∈ θs[end-1, :]]
results["μ_post_$i"] = μ_post
results["σ_post_$i"] = σ_post
results["n_its_$i"] = length(θs)
results["n_sims_$i"] = Ne * (length(θs) - 1)
end
save_results(results, fname)
end