Skip to content

Commit e97036f

Browse files
committed
CHG: FIX typos, log level, ...
1 parent 50faaf4 commit e97036f

2 files changed

Lines changed: 34 additions & 45 deletions

File tree

tutorial4.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def _():
6060
import memilio.simulation.osecir as osecir
6161
from memilio.simulation import AgeGroup, Damping, LogLevel, set_log_level
6262
# deactivate the log level to avoid warning messages from adaptive step sizing
63-
set_log_level(LogLevel.Error)
63+
set_log_level(LogLevel.Warning)
6464
return AgeGroup, LogLevel, osecir, set_log_level
6565

6666

@@ -170,9 +170,7 @@ def run_simulation(parameters, tmax = tmax):
170170
set_parameters(influenza_model, parameters)
171171
influenza_model.parameters.ContactPatterns.cont_freq_mat[0].baseline = np.ones((1,1)) * contact_frequency
172172
# Check that the parameters are meaningful, i.e., no negative dwelling times
173-
set_log_level(LogLevel.Warn)
174173
influenza_model.check_constraints()
175-
set_log_level(LogLevel.Off)
176174

177175
result = osecir.simulate(t0, tmax, 0.1, influenza_model)
178176
return {"data": osecir.interpolate_simulation_result(result).as_ndarray()}
@@ -295,7 +293,7 @@ def _(mo):
295293

296294
@app.cell
297295
def _(pd):
298-
observation_data = pd.read_csv("cases_1.csv")
296+
observation_data = pd.read_csv("data/cases_1.csv")
299297
return (observation_data,)
300298

301299

@@ -342,7 +340,7 @@ def _(mo):
342340
mo.md(r"""
343341
# Inference process
344342
345-
With all the previous work done, there are only four more lines of code needed to run the inference process. First, we need to create the fitting object. It is called `ABCSMC` because we perform the fitting using Approximate Bayesian Computation -Sequential Monte Carlo. The object is created by giving it our simulation function, the prior and the distance. We set the population size to the somewhat arbitrary value of 400. This will reduce the chance of numerical instabilites. There are more possible parameters for which we will just use the defaults. The full documentation is available [here](https://pyabc.readthedocs.io/en/latest/api/pyabc.inference.html#pyabc.inference.ABCSMC).
343+
With all the previous work done, there are only four more lines of code needed to run the inference process. First, we need to create the fitting object. It is called `ABCSMC` because we perform the fitting using Approximate Bayesian Computation - Sequential Monte Carlo. The object is created by giving it our simulation function, the prior and the distance. We set the population size to the somewhat arbitrary value of 400. This will reduce the chance of numerical instabilites. There are more possible parameters for which we will just use the defaults. The full documentation is available [here](https://pyabc.readthedocs.io/en/latest/api/pyabc.inference.html#pyabc.inference.ABCSMC).
346344
347345
Then we need to define a database path. `pyabc` stores all simulations in a database. This allows us to take a closer look at them after the inference. However, here we will use a temporary directory to store the database. Once we have found that folder, we need to create the database before finally running the inference.
348346

0 commit comments

Comments
 (0)