Commit 8d0333c7 authored by Peter Jentsch's avatar Peter Jentsch
Browse files

new parameter planes, optionally record degrees

parent 6cfb5d27
const population = 14.57e6 #population of ontario
const workschool_mixing, rest_mixing = load_mixing_matrices()
const age_bins = [(0.0, 25.0),(25.0,65.0),(65.0,Inf)]
const household_data = read_household_data()
......@@ -33,8 +31,8 @@ end
"""
Run the model with given parameter tuple and output recorder. See `get_parameters` for list of parameters. See `output.jl` for the list of recorders. Currently just 'DebugRecorder`.
"""
function abm(parameters)
model_sol = ModelSolution(parameters.sim_length,parameters,parameters.num_households; record_degrees = false)
function abm(parameters; record_degrees = false)
model_sol = ModelSolution(parameters.sim_length,parameters,parameters.num_households;record_degrees)
solve!(model_sol)
return model_sol
end
......@@ -92,11 +92,11 @@ function record!(t,modelsol)
end
function mean_solve(samples,parameter_tuple;progmeter = nothing)
function mean_solve(samples,parameter_tuple;progmeter = nothing, record_degrees = false)
accumulation_recorder = Recorder(Variance(), parameter_tuple.sim_length)
avg_populations = [0.0,0.0,0.0]
sol_list = map(1:samples) do _
sol = abm(parameter_tuple)
sol = abm(parameter_tuple;record_degrees)
isnothing(progmeter) || next!(progmeter)
return sol.output_data,length.(sol.index_vectors)
end
......
const samples = 25
const samples = 40
const univariate_path = "CovidAlertVaccinationModel/plots/univariate/"
const bivariate_path = "CovidAlertVaccinationModel/plots/univariate/"
function univarate_test(variable, variable_range; progmeter = nothing)
......@@ -58,7 +58,7 @@ end
using AxisKeys
function multivariate_simulations()
len = 20
len = 15
app_simulations = (
(:η, range(0.0, 2.0; length = len)),
(:ω_en, range(0.0, 1e-1; length = len)),
......@@ -79,13 +79,13 @@ function run_multivariate_sims(sims)
progmeter = Progress((length(simvars)+1)*samples)
without_app, _ = mean_solve(samples,get_parameters(); progmeter)
without_app, _ = mean_solve(samples,get_parameters(); progmeter, record_degrees = true)
next!(progmeter)
default_parameters = get_app_parameters()
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;progmeter)
out,_ = mean_solve(samples, parameters;progmeter, record_degrees = true)
return out
end
display(length(simvars))
......@@ -108,15 +108,20 @@ function plot_parameter_plane(input_fname)
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"]
mean_weighted_degree_change(p,age) = mean(p.avg_weighted_degree_of_vaccinators[age])-mean(p.avg_weighted_degree[age])
weighted_degree_map = [map(p -> mean_weighted_degree_change(p,i),output) for i in 1:3]
cs = cgrad(:blues)
datamaps = (weighted_degree_map..., final_size_map)
fnames = [
"wdg_change_Y.pdf",
"wdg_change_M.pdf",
"wdg_change_O.pdf",
"final_size_change.pdf"
]
titles = [
"Average w. deg. of vaccinators minus average w. deg.",
"Average w. deg. of vaccinators minus average w. deg., Y",
"Average w. deg. of vaccinators minus average w. deg., M",
"Average w. deg. of vaccinators minus average w. deg., O",
"Effect of notifications on tot. infections",
]
for (fname,title,datamap) in zip(fnames,titles,datamaps)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment