Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
Peter Jentsch
CovidAlertABM
Commits
4d549016
Commit
4d549016
authored
Jun 17, 2021
by
Peter Jentsch
Browse files
first heatmaps
parent
2bda668f
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
42 additions
and
84 deletions
+42
-84
CovidAlertVaccinationModel/Project.toml
CovidAlertVaccinationModel/Project.toml
+1
-0
CovidAlertVaccinationModel/abm_output/η_ω_en.dat
CovidAlertVaccinationModel/abm_output/η_ω_en.dat
+0
-0
CovidAlertVaccinationModel/abm_timeseries.jl
CovidAlertVaccinationModel/abm_timeseries.jl
+2
-2
CovidAlertVaccinationModel/plots/app_heatmaps/final_size_change.pdf
...VaccinationModel/plots/app_heatmaps/final_size_change.pdf
+0
-0
CovidAlertVaccinationModel/plots/app_heatmaps/wdg_change.pdf
CovidAlertVaccinationModel/plots/app_heatmaps/wdg_change.pdf
+0
-0
CovidAlertVaccinationModel/prem_mixing_approx.jl
CovidAlertVaccinationModel/prem_mixing_approx.jl
+0
-69
CovidAlertVaccinationModel/src/ABM/model_setup.jl
CovidAlertVaccinationModel/src/ABM/model_setup.jl
+2
-2
CovidAlertVaccinationModel/src/ABM/parameter_planes.jl
CovidAlertVaccinationModel/src/ABM/parameter_planes.jl
+37
-11
timeseries.pdf
timeseries.pdf
+0
-0
No files found.
CovidAlertVaccinationModel/Project.toml
View file @
4d549016
...
...
@@ -7,6 +7,7 @@ version = "0.1.0"
AxisKeys
=
"94b1ba4f-4ee9-5380-92f1-94cde586c3c5"
BenchmarkTools
=
"6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf"
CSV
=
"336ed68f-0bac-5ca0-87d4-7b16caf5d00b"
ColorSchemes
=
"35d6a980-a343-548e-a6ea-1d62b119f2f4"
CurveFit
=
"5a033b19-8c74-5913-a970-47c3779ef25c"
DataFrames
=
"a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
DataStructures
=
"864edb3b-99cc-5e75-8d2d-829cb0a9cfe8"
...
...
CovidAlertVaccinationModel/abm_output/η_ω_en.dat
View file @
4d549016
No preview for this file type
CovidAlertVaccinationModel/abm_timeseries.jl
View file @
4d549016
...
...
@@ -6,7 +6,7 @@ using CovidAlertVaccinationModel:vaccination_data,ymo_vac,ymo_attack_rate
const
samples
=
10
function
solve_and_plot_parameters
()
p
=
CovidAlertVaccinationModel
.
get_parameters
()
p
=
CovidAlertVaccinationModel
.
get_
app_
parameters
()
display
(
p
)
out
,
avg_populations
=
mean_solve
(
samples
,
p
,
DebugRecorder
)
p
=
plot_model
(
nothing
,[
nothing
],[
out
],
p
.
infection_introduction_day
,
p
.
immunization_begin_day
)
...
...
@@ -14,7 +14,7 @@ function solve_and_plot_parameters()
ymo_vaccination_ts
=
mean
.
(
out
.
daily_immunized_by_age
)
total_postinf_vaccination
=
mean
.
(
out
.
total_postinf_vaccination
)
#sum.(eachrow(ymo_vaccination_ts[:,180:end]))
final_size
=
mean
.
(
out
.
final_size_by_age
)
#sum.(eachrow(mean.(out.daily_unvac_cases_by_age)))
final_size
=
mean
.
(
out
.
unvac_
final_size_by_age
)
#sum.(eachrow(mean.(out.daily_unvac_cases_by_age)))
total_preinf_vaccination
=
mean
.
(
out
.
total_preinf_vaccination
)
#sum.(eachrow(ymo_vaccination_ts[:,1:180]))
target_final_size
=
ymo_attack_rate
.*
avg_populations
target_preinf_vac
=
ymo_vac
.*
sum
(
vaccination_data
[
1
:
4
])
.*
avg_populations
...
...
CovidAlertVaccinationModel/plots/app_heatmaps/final_size_change.pdf
0 → 100644
View file @
4d549016
File added
CovidAlertVaccinationModel/plots/app_heatmaps/wdg_change.pdf
0 → 100644
View file @
4d549016
File added
CovidAlertVaccinationModel/prem_mixing_approx.jl
deleted
100644 → 0
View file @
2bda668f
using
CovidAlertVaccinationModel
:
abm
,
ModelSolution
,
get_parameters
,
neighbors
,
GraphEdge
,
get_weight
,
contact_time_distributions
using
LightGraphs
function
approximate_mixing_matricies_1
(
sol
)
mean_mixing_degree
=
zeros
(
3
,
3
)
mean_mixing_weighted_degree
=
zeros
(
3
,
3
)
display
(
p
.
O_distribution_shift
)
te_missed
=
zeros
(
8
)
te
=
zeros
(
8
)
edgelist
=
[]
for
g_list
in
sol
.
inf_network
.
graph_list
for
(
k
,
g
)
in
enumerate
(
g_list
)
# display(g.mixing_edges.weights_dict)
for
e
in
keys
(
g
.
mixing_edges
.
weights_dict
)
demo_i
=
sol
.
demographics
[
e
.
a
]
demo_j
=
sol
.
demographics
[
e
.
b
]
if
(
has_edge
(
g
.
g
,
e
.
a
,
e
.
b
))
mean_mixing_degree
[
Int
(
demo_i
),
Int
(
demo_j
)]
+=
1
mean_mixing_degree
[
Int
(
demo_j
),
Int
(
demo_i
)]
+=
1
mean_mixing_weighted_degree
[
Int
(
demo_i
),
Int
(
demo_j
)]
+=
get_weight
(
g
,
GraphEdge
(
e
.
a
,
e
.
b
))
mean_mixing_weighted_degree
[
Int
(
demo_j
),
Int
(
demo_i
)]
+=
get_weight
(
g
,
GraphEdge
(
e
.
a
,
e
.
b
))
te
[
k
]
+=
1
else
push!
(
edgelist
,
e
)
te_missed
[
k
]
+=
1
end
end
end
end
mean_mixing_degree
./=
(
500
.*
length
.
(
sol
.
index_vectors
)
*
2
)
mean_mixing_weighted_degree
./=
(
500
.*
length
.
(
sol
.
index_vectors
)
*
2
)
display
(
mean_mixing_degree
)
display
(
mean_mixing_weighted_degree
)
display
(
te_missed
)
return
sol
end
function
approximate_mixing_matricies_2
(
sol
)
mean_mixing_degree
=
zeros
(
3
,
3
)
mean_mixing_weighted_degree
=
zeros
(
3
,
3
)
te_missed
=
zeros
(
8
)
display
(
p
.
O_distribution_shift
)
for
g_list
in
sol
.
inf_network
.
graph_list
for
g
in
g_list
# display(g.mixing_edges.weights_dict)
for
e
in
edges
(
g
.
g
)
demo_i
=
sol
.
demographics
[
src
(
e
)]
demo_j
=
sol
.
demographics
[
dst
(
e
)]
mean_mixing_degree
[
Int
(
demo_i
),
Int
(
demo_j
)]
+=
1
#get_weight(g,GraphEdge(node_i,node_j)) /2
mean_mixing_degree
[
Int
(
demo_j
),
Int
(
demo_i
)]
+=
1
#get_weight(g,GraphEdge(node_i,node_j)) /2
mean_mixing_weighted_degree
[
Int
(
demo_i
),
Int
(
demo_j
)]
+=
get_weight
(
g
,
GraphEdge
(
src
(
e
),
dst
(
e
)))
mean_mixing_weighted_degree
[
Int
(
demo_j
),
Int
(
demo_i
)]
+=
get_weight
(
g
,
GraphEdge
(
src
(
e
),
dst
(
e
)))
end
end
end
mean_mixing_degree
./=
(
500
.*
length
.
(
sol
.
index_vectors
)
*
2
)
mean_mixing_weighted_degree
./=
(
500
.*
length
.
(
sol
.
index_vectors
)
*
2
)
return
sol
end
p
=
get_parameters
()
sol
=
abm
(
p
,
nothing
)
approximate_mixing_matricies_1
(
sol
);
approximate_mixing_matricies_2
(
sol
);
println
(
"dasdlkjasdas"
)
#rerun with weights
#
\ No newline at end of file
CovidAlertVaccinationModel/src/ABM/model_setup.jl
View file @
4d549016
...
...
@@ -15,8 +15,8 @@ function get_parameters()#(0.0000,0.00048,0.0005,0.16,-1.30,-1.24,-0.8,0.35,0.35
π_base_o
=
-
0.95
,
η
=
0.0
,
κ
=
0.0
,
ω
=
0.0
055
,
ω_en
=
0.00
,
ω
=
0.0
,
ω_en
=
0.00
05
,
Γ
=
1
/
7
,
ξ
=
5.0
,
notification_parameter
=
0.001
,
...
...
CovidAlertVaccinationModel/src/ABM/parameter_planes.jl
View file @
4d549016
...
...
@@ -17,7 +17,7 @@ if !ispath(univariate_path)
mkdir
(
univariate_path
)
end
function
univariate_simulations
()
len
=
1
0
len
=
2
0
univarate_test_list
=
(
# (:I_0_fraction, range(0.0, 0.05; length = len)),
# (:base_transmission_probability, range(0.0002, 0.002; length = len)),
...
...
@@ -48,14 +48,14 @@ end
using
AxisKeys
function
multivariate_simulations
()
len
=
1
0
len
=
1
5
samples
=
10
app_simulations
=
(
(
:
η
,
range
(
0.0
,
0.01
;
length
=
len
)),
(
:
ω_en
,
range
(
0.0
,
0.
00
05
;
length
=
len
)),
(
:
ω_en
,
range
(
0.0
,
0.05
;
length
=
len
)),
# (:notification_threshold, (1:len)),
)
run_multivariate_sims
(
app_simulations
,
1
)
run_multivariate_sims
(
app_simulations
,
samples
)
# for ((varname,_),p) in zip(univarate_test_list,plt_list)
...
...
@@ -65,26 +65,52 @@ end
using
ProgressMeter
function
run_multivariate_sims
(
sims
,
samples
)
varnames
,
sim_ranges
=
zip
(
sims
...
)
without_app_future
=
@spawn
mean_solve
(
samples
,
get_parameters
(),
HeatmapRecorder
)
default_parameters
=
get_app_parameters
()
simvars
=
Iterators
.
product
(
sim_ranges
...
)
progmeter
=
Progress
(
length
(
simvars
))
output
=
ThreadsX
.
map
(
simvars
)
do
vars
app_
output
=
ThreadsX
.
map
(
simvars
)
do
vars
vars_with_names
=
NamedTuple
{
varnames
}(
vars
)
parameters
=
merge
(
default_parameters
,
vars_with_names
)
out
,
_
=
mean_solve
(
samples
,
parameters
,
Debug
Recorder
)
out
,
_
=
mean_solve
(
1
,
parameters
,
Heatmap
Recorder
)
next!
(
progmeter
)
return
out
end
display
(
length
(
simvars
))
fname
=
join
(
string
.
(
varnames
),
"_"
)
keyed_output
=
KeyedArray
(
output
;
NamedTuple
{
varnames
}(
sim_ranges
)
...
)
keyed_output
=
KeyedArray
(
app_
output
;
NamedTuple
{
varnames
}(
sim_ranges
)
...
)
path
=
joinpath
(
PACKAGE_FOLDER
,
"abm_output"
,
"
$
fname.dat"
)
serialize
(
path
,
keyed_output
)
serialize
(
path
,
(
fetch
(
without_app_future
)[
1
],
keyed_output
)
)
return
fname
end
using
ColorSchemes
using
LaTeXStrings
function
plot_parameter_plane
(
input_fname
)
map
(
1
:
length
(
axiskeys
(
output
)[
end
]))
do
i
path
=
joinpath
(
PACKAGE_FOLDER
,
"abm_output"
,
"
$
input_fname.dat"
)
output_no_app
,
output
=
deserialize
(
path
)
var_ranges
=
axiskeys
(
output
)
vars
=
(
L"\eta"
,
L"\omega_{en}"
)
mean_final_size
(
p
)
=
mean
(
reduce
(
merge!
,
p
.
final_size_by_age
))
base_outcome
=
mean_final_size
(
output_no_app
)
final_size_map
=
map
(
x
->
(
mean_final_size
(
x
)
-
base_outcome
),
output
)
mean_weighted_degree_change
(
p
)
=
mean
(
p
.
avg_weighted_degree_of_vaccinators
)
-
mean
(
p
.
avg_weighted_degree
)
weighted_degree_map
=
map
(
mean_weighted_degree_change
,
output
)
cs
=
cgrad
([
:
blue
,
:
orange
])
datamaps
=
[
weighted_degree_map
,
final_size_map
]
fnames
=
[
"wdg_change.pdf"
,
"final_size_change.pdf"
]
titles
=
[
"Average w. deg. of vaccinators minus average w. deg."
,
"Change in average final size of infection outbreak"
,
]
for
(
fname
,
title
,
datamap
)
in
zip
(
fnames
,
titles
,
datamaps
)
p
=
heatmap
(
var_ranges
[
1
],
var_ranges
[
2
],
datamap
;
title
,
xlabel
=
vars
[
1
],
ylabel
=
vars
[
2
],
seriescolor
=
cs
,
size
=
(
800
,
600
))
savefig
(
p
,
joinpath
(
PACKAGE_FOLDER
,
"plots"
,
"app_heatmaps"
,
"
$
fname"
))
end
end
\ No newline at end of file
timeseries.pdf
View file @
4d549016
No preview for this file type
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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