Skip to content

Commit

Permalink
influenza tutorial
Browse files Browse the repository at this point in the history
  • Loading branch information
twallema committed Jul 19, 2024
1 parent 468a3dc commit 33919b5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
6 changes: 3 additions & 3 deletions docs/influenza_1718.md
Original file line number Diff line number Diff line change
Expand Up @@ -301,11 +301,11 @@ if __name__ == '__main__':
data=[df_influenza[start_date:end_calibration], ]
states = ["Im_inc",]
log_likelihood_fnc = [ll_negative_binomial,]
log_likelihood_fnc_args = [5*[0.03,],]
log_likelihood_fnc_args = [4*[0.03,],]
# Calibated parameters and bounds
pars = ['beta', 'f_a']
labels = ['$\\beta$', '$f_a$']
pars = ['beta', 'f_ud']
labels = ['$\\beta$', '$f_{ud}$']
bounds = [(1e-6,0.06), (0,0.99)]
# Setup objective function (no priors --> uniform priors based on bounds)
Expand Down
5 changes: 3 additions & 2 deletions tutorials/influenza_1718/calibration.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@
# Assign results to model
model.parameters = assign_theta(model.parameters, pars, theta)
# Simulate model
out = model.sim([start_calibration, end_visualisation], samples={}, N=n, tau=tau, output_timestep=1)
out = model.sim([start_calibration, end_visualisation], N=n, tau=tau)
# Add poisson obervational noise
out = add_negative_binomial_noise(out, alpha)
# Visualize
Expand Down Expand Up @@ -223,7 +223,8 @@ def draw_fcn(parameters, samples):
parameters['f_ud'] = np.array([slice[idx] for slice in samples['f_ud']])
return parameters
# Simulate model
out = model.sim([start_visualisation, end_visualisation], N=n, tau=tau, output_timestep=1, samples=samples_dict, draw_function=draw_fcn, processes=processes)
out = model.sim([start_visualisation, end_visualisation], N=n, tau=tau, output_timestep=1,
draw_function=draw_fcn, draw_function_kwargs={'samples': samples_dict}, processes=processes)
# Add negative binomial observation noise
out_noise = add_negative_binomial_noise(out, alpha)

Expand Down

0 comments on commit 33919b5

Please sign in to comment.