Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Peter Jentsch
CovidAlertABM
Commits
09028419
Commit
09028419
authored
Jun 06, 2021
by
Peter Jentsch
Browse files
fit with fixed beta
parent
56dd216a
Changes
5
Hide whitespace changes
Inline
Side-by-side
CovidAlertVaccinationModel/abm_parameter_fits/fit_all_parameters.dat
View file @
09028419
No preview for this file type
CovidAlertVaccinationModel/src/ABM/parameter_optimization.jl
View file @
09028419
...
...
@@ -15,15 +15,13 @@ function solve_w_parameters(default_p, p_names, new_p_list)
end
function
fit_distribution_parameters
(
p_tuple
)
p_names
=
(
:
ω
,
:
β_y
,
:
β_m
,
:
β_o
,
:
π_base_y
,
:
π_base_m
,
:
π_base_o
)
p_names
=
(
:
ω
,
:
π_base_y
,
:
π_base_m
,
:
π_base_o
,
:
ζ
)
priors
=
Factored
(
Uniform
(
0.0
,
0.01
),
Uniform
(
0.0
,
0.5
),
Uniform
(
0.0
,
0.5
),
Uniform
(
0.0
,
1.0
),
Uniform
(
-
5.0
,
3.0
),
Uniform
(
-
5.0
,
3.0
),
Uniform
(
-
5.0
,
3.0
),
Uniform
(
-
5.0
,
3.0
),
Uniform
(
1.0
,
2.0
),
)
#simulation begins in july
#60 days for opinion dynamics to stabilize, then immunization begins in september,
...
...
@@ -61,15 +59,15 @@ function fit_distribution_parameters(p_tuple)
end
# display(cost((0.005,0.00075, 0.00063,0.75,-1.4,-1.4,-0.95)))
out
=
smc
(
priors
,
cost
;
verbose
=
true
,
nparticles
=
100
0
,
parallel
=
true
)
out
=
smc
(
priors
,
cost
;
verbose
=
true
,
nparticles
=
25
0
,
parallel
=
true
)
return
NamedTuple
{
p_names
}(
ntuple
(
i
->
out
.
P
[
i
]
.
particles
,
length
(
p_names
)))
end
function
fit_parameters
(
default_parameters
)
# pre_inf_behaviour_parameters_path =joinpath(PACKAGE_FOLDER,"abm_parameter_fits","pre_inf_behaviour_parameters.dat")
# post_inf_behaviour_parameters_path = joinpath(PACKAGE_FOLDER,"abm_parameter_fits","post_inf_behaviour_parameters.dat")
fit_all_parameters_path
=
joinpath
(
PACKAGE_FOLDER
,
"abm_parameter_fits"
,
"fit_all_parameters.dat"
)
#
output = fit_distribution_parameters(default_parameters)
#
serialize(fit_all_parameters_path,output)
output
=
fit_distribution_parameters
(
default_parameters
)
serialize
(
fit_all_parameters_path
,
output
)
fitted_parameter_tuple
=
deserialize
(
fit_all_parameters_path
)
...
...
@@ -88,13 +86,13 @@ function plot_fitting_posteriors(fname,particles_tuple,parameters)
avg_populations
=
[
0.0
,
0.0
,
0.0
]
names
=
keys
(
particles_tuple
)
samples
=
collect
(
zip
(
particles_tuple
...
))
for
p_set
in
sample
(
samples
,
1
)
for
p_set
in
sample
(
samples
,
30
)
p_set_named
=
NamedTuple
{
names
}(
p_set
)
sol
=
abm
(
merge
(
parameters
,
p_set_named
),
output_recorder
)
avg_populations
.+=
length
.
(
sol
.
index_vectors
)
fit!
(
stat_recorder
,
output_recorder
)
end
avg_populations
./=
1
avg_populations
./=
30
p
=
plot_model
(
nothing
,[
nothing
],[
stat_recorder
],
parameters
.
infection_introduction_day
,
parameters
.
immunization_begin_day
)
savefig
(
p
,
"
$
fname.pdf"
)
...
...
post_inf_fitting.pdf
View file @
09028419
No preview for this file type
post_inf_fitting_posteriors.pdf
View file @
09028419
No preview for this file type
timeseries.pdf
View file @
09028419
No preview for this file type
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment