|
1 | 1 | import marimo |
2 | 2 |
|
3 | | -__generated_with = "0.19.11" |
| 3 | +__generated_with = "0.20.0" |
4 | 4 | app = marimo.App(width="medium") |
5 | 5 |
|
6 | 6 |
|
@@ -267,13 +267,12 @@ def distance_ICU(simulation, real_data): |
267 | 267 | return np.sum(np.abs(real_ICU - sim_ICU)) |
268 | 268 |
|
269 | 269 | def distance_Deaths(simulation, real_data): |
270 | | - deaths_per_critical = 1 |
271 | 270 | real_Deaths = real_data['Deaths'] |
272 | 271 | sim = simulation['data'] |
273 | 272 | sim_Death = sim[1 + int(osecir.InfectionState.Dead), :] |
274 | | - return 1/deaths_per_critical * np.sum(np.abs(real_Deaths - sim_Death)) |
| 273 | + return np.sum(np.abs(real_Deaths - sim_Death)) |
275 | 274 |
|
276 | | - distance = pyabc.AdaptiveAggregatedDistance([distance_ICU, distance_Deaths], adaptive=False, scale_function=pyabc.distance.mean) |
| 275 | + distance = pyabc.AdaptiveAggregatedDistance([distance_ICU, distance_Deaths], adaptive=False, scale_function=pyabc.distance.median) |
277 | 276 | return (distance,) |
278 | 277 |
|
279 | 278 |
|
@@ -313,7 +312,7 @@ def _(example_results): |
313 | 312 |
|
314 | 313 | @app.cell |
315 | 314 | def _(distance, example_results, observation_data): |
316 | | - distance(example_results, observation_data) |
| 315 | + distance(example_results, observation_data, t=-1) |
317 | 316 | return |
318 | 317 |
|
319 | 318 |
|
@@ -349,15 +348,15 @@ def _(mo): |
349 | 348 |
|
350 | 349 | @app.cell |
351 | 350 | def _(distance, observation_data, os, prior, pyabc, run_simulation, tempfile): |
352 | | - abc = pyabc.ABCSMC(run_simulation, prior, distance, population_size=400, sampler=pyabc.sampler.SingleCoreSampler()) |
| 351 | + abc = pyabc.ABCSMC(run_simulation, prior, distance, population_size=400) |
353 | 352 | db_path = "sqlite:///" + os.path.join(tempfile.gettempdir(), "tmp.db") |
354 | 353 | abc.new(db_path, observation_data) |
355 | 354 | return (abc,) |
356 | 355 |
|
357 | 356 |
|
358 | 357 | @app.cell |
359 | 358 | def _(abc): |
360 | | - history = abc.run(minimum_epsilon=1e-03) |
| 359 | + history = abc.run(minimum_epsilon=5e-01) |
361 | 360 | return (history,) |
362 | 361 |
|
363 | 362 |
|
|
0 commit comments