Skip to content

Commit 78dffdc

Browse files
committed
Modification to ideal network parameters in hpc scripts and demo
1 parent 699c7d5 commit 78dffdc

File tree

3 files changed

+97
-78
lines changed

3 files changed

+97
-78
lines changed

hpc/calibrate_stochastic.py

+25-19
Original file line numberDiff line numberDiff line change
@@ -24,48 +24,50 @@
2424

2525
# Construct the network G
2626
# ~~~~~~~~~~~~~~~~~~~~~~~
27-
numNodes = 30000
28-
baseGraph = networkx.barabasi_albert_graph(n=numNodes, m=7)
27+
numNodes = 90000
28+
baseGraph = networkx.barabasi_albert_graph(n=numNodes, m=3)
2929
# Baseline normal interactions:
30-
G_norm = models.custom_exponential_graph(baseGraph, scale=200)
30+
G_norm = models.custom_exponential_graph(baseGraph, scale=500)
3131
models.plot_degree_distn(G_norm, max_degree=40)
3232

3333
# Construct the network G under social distancing
3434
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
35-
numNodes = 30000
36-
baseGraph = networkx.barabasi_albert_graph(n=numNodes, m=2)
35+
numNodes = 90000
36+
baseGraph = networkx.barabasi_albert_graph(n=numNodes, m=1)
3737
# Baseline normal interactions:
38-
G_dist = models.custom_exponential_graph(baseGraph, scale=20000)
38+
G_dist = models.custom_exponential_graph(baseGraph, scale=200000)
3939
models.plot_degree_distn(G_dist, max_degree=40)
4040

4141
# Define model
4242
# ~~~~~~~~~~~~
4343
model = models.SEIRSNetworkModel(
4444
# network connectivty
4545
G = G_norm,
46-
p = 0.6,
46+
p = 0.51,
4747
# clinical parameters
48-
beta = 0.05,
49-
sigma = 5.2,
48+
beta = 0.20,
49+
sigma = 4.0,
50+
omega = 1.5,
5051
zeta = 0,
5152
a = 0.43, # probability of an asymptotic (supermild) infection
5253
m = 1-0.43, # probability of a mild infection
5354
h = 0.20, # probability of hospitalisation for a mild infection
5455
c = 2/3, # probability of hospitalisation in cohort
5556
mi = 1/6, # probability of hospitalisation in midcare
56-
da = 14, # days of infection when asymptomatic (supermild)
57-
dm = 14, # days of infection when mild
57+
da = 6.5, # days of infection when asymptomatic (supermild)
58+
dm = 6.5, # days of infection when mild
5859
dc = 7,
5960
dmi = 14,
6061
dICU = 14,
6162
dICUrec = 6,
6263
dmirec = 6,
63-
dhospital = 3, # days before reaching the hospital when heavy or critical
64+
dhospital = 5, # days before reaching the hospital when heavy or critical
6465
m0 = 0.49, # mortality in ICU
6566
maxICU = 2000,
6667
# testing
6768
theta_S = 0,
6869
theta_E = 0,
70+
theta_I = 0,
6971
theta_A = 0,
7072
theta_M = 0,
7173
theta_R = 0,
@@ -75,11 +77,13 @@
7577
# back-tracking
7678
phi_S = 0,
7779
phi_E = 0,
80+
phi_I = 0,
7881
phi_A = 0,
7982
phi_R = 0,
8083
# initial condition
8184
initN = 11.43e6, #results are extrapolated to entire population
82-
initE = 100,
85+
initE = 0,
86+
initI = 3,
8387
initA = 0,
8488
initM = 0,
8589
initC = 0,
@@ -89,13 +93,15 @@
8993
initD = 0,
9094
initSQ = 0,
9195
initEQ = 0,
96+
initIQ = 0,
9297
initAQ = 0,
9398
initMQ = 0,
9499
initRQ = 0,
95100
# monte-carlo sampling
96-
monteCarlo = True,
101+
monteCarlo = False,
97102
repeats = 1
98103
)
104+
99105
# Load data
100106
# ~~~~~~~~~~~~
101107
#[index,data] = model.obtainData()
@@ -111,19 +117,19 @@
111117
# vector with dates
112118
index=pd.date_range('2020-03-13', freq='D', periods=ICUvect.size)
113119
# data series used to calibrate model must be given to function 'plotFit' as a list
114-
idx = -26
120+
idx = -23
115121
index = index[0:idx]
116122
data=[np.transpose(ICUvect[:,0:idx]),np.transpose(hospital[:,0:idx])]
117123
# set optimisation settings
118-
parNames = ['beta','p'] # must be a list!
124+
parNames = ['beta'] # must be a list!
119125
positions = [np.array([6]),np.array([4,5,6])] # must be a list!
120-
bounds=[(10,100),(0.1,0.5),(0.4,0.8)] # must be a list!
126+
bounds=[(10,100),(0.25,0.60)] # must be a list!
121127
weights = np.array([0,1])
122128
# run optimisation
123-
theta = model.fit(data,parNames,positions,bounds,weights,setvar=True,maxiter=10,popsize=5)
129+
theta = model.fit(data,parNames,positions,bounds,weights,setvar=True,maxiter=15,popsize=multiprocessing.cpu_count())
124130
stop = timeit.default_timer()
125131
print('Required time: ', stop - start,' seconds')
126132

127133
# Make a graphical representation of results
128134
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
129-
model.plotFit(index,data,positions,modelClr=['red','orange'],legendText=('ICU (model)','ICU (data)','Hospital (model)','Hospital (data)'),titleText='Belgium',filename-'calibration.svg')
135+
model.plotFit(index,data,positions,modelClr=['red','orange'],legendText=('ICU (model)','ICU (data)','Hospital (model)','Hospital (data)'),titleText='Belgium',filename-'calibration90K.svg')

hpc/sim_stochastic.py

+19-15
Original file line numberDiff line numberDiff line change
@@ -24,43 +24,44 @@
2424

2525
# Construct the network G
2626
# ~~~~~~~~~~~~~~~~~~~~~~~
27-
numNodes = 60000
28-
baseGraph = networkx.barabasi_albert_graph(n=numNodes, m=7)
27+
numNodes = 90000
28+
baseGraph = networkx.barabasi_albert_graph(n=numNodes, m=3)
2929
# Baseline normal interactions:
30-
G_norm = models.custom_exponential_graph(baseGraph, scale=200)
30+
G_norm = models.custom_exponential_graph(baseGraph, scale=500)
3131
models.plot_degree_distn(G_norm, max_degree=40)
3232

3333
# Construct the network G under social distancing
3434
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
35-
numNodes = 60000
36-
baseGraph = networkx.barabasi_albert_graph(n=numNodes, m=2)
35+
numNodes = 90000
36+
baseGraph = networkx.barabasi_albert_graph(n=numNodes, m=1)
3737
# Baseline normal interactions:
38-
G_dist = models.custom_exponential_graph(baseGraph, scale=20000)
38+
G_dist = models.custom_exponential_graph(baseGraph, scale=200000)
3939
models.plot_degree_distn(G_dist, max_degree=40)
4040

4141
# Define model
4242
# ~~~~~~~~~~~~
4343
model = models.SEIRSNetworkModel(
4444
# network connectivty
4545
G = G_norm,
46-
p = 0.6,
46+
p = 0.51,
4747
# clinical parameters
48-
beta = 0.05,
49-
sigma = 5.2,
48+
beta = 0.03,
49+
sigma = 4.0,
50+
omega = 1.5,
5051
zeta = 0,
5152
a = 0.43, # probability of an asymptotic (supermild) infection
5253
m = 1-0.43, # probability of a mild infection
5354
h = 0.20, # probability of hospitalisation for a mild infection
5455
c = 2/3, # probability of hospitalisation in cohort
5556
mi = 1/6, # probability of hospitalisation in midcare
56-
da = 14, # days of infection when asymptomatic (supermild)
57-
dm = 14, # days of infection when mild
57+
da = 6.5, # days of infection when asymptomatic (supermild)
58+
dm = 6.5, # days of infection when mild
5859
dc = 7,
5960
dmi = 14,
6061
dICU = 14,
6162
dICUrec = 6,
6263
dmirec = 6,
63-
dhospital = 3, # days before reaching the hospital when heavy or critical
64+
dhospital = 5, # days before reaching the hospital when heavy or critical
6465
m0 = 0.49, # mortality in ICU
6566
maxICU = 2000,
6667
# testing
@@ -75,11 +76,13 @@
7576
# back-tracking
7677
phi_S = 0,
7778
phi_E = 0,
79+
phi_I = 0,
7880
phi_A = 0,
7981
phi_R = 0,
8082
# initial condition
8183
initN = 11.43e6, #results are extrapolated to entire population
82-
initE = 100,
84+
initE = 0,
85+
initI = 1,
8386
initA = 0,
8487
initM = 0,
8588
initC = 0,
@@ -89,12 +92,13 @@
8992
initD = 0,
9093
initSQ = 0,
9194
initEQ = 0,
95+
initIQ = 0,
9296
initAQ = 0,
9397
initMQ = 0,
9498
initRQ = 0,
9599
# monte-carlo sampling
96-
monteCarlo = True,
97-
repeats = 10
100+
monteCarlo = False,
101+
repeats = 3
98102
)
99103

100104
# Create checkpoints dictionary

0 commit comments

Comments
 (0)