OSCR

A comparative study of simulation-based inference methods for epidemic models with identifiability considerations.

Code ↔ Paper

7 matches between paragraphs of the paper and lines of its authors' code, computed by the harvester (lexical-v1). Click a colored paragraph or line to see its counterpart.

6 blocks of code here have a permanent identifier (oscr:b:…), listed with the matches below: citable for good, with a page of its own. Select a match and press Cite to copy it. What a block identifier is.

The 7 matches · 2 of them tie a paragraph to a whole file without given lines: weak matches, whose lines are not tinted
  1. [1] § 4. Methods › 4.5. Experiments › 4.5.1. Methodological configurations. ↔ temp_backup/src/inference.py, lines 40 to 87 · score 0.72 · Euclidean distance, quantile epsilon, simulation budgets, configuration, population, ABC · block oscr:b:EN5N50J7QYPG8-W · Report a mismatch
  2. [2] § 4. Methods › 4.5. Experiments › 4.5.1. Methodological configurations. ↔ temp_backup/src/distance.py, lines 4 to 17 · score 0.64 · L2 norm, Euclidean distance, trajectories, epidemic, simulation · block oscr:b:16J0E6W9JG1JK-E · Report a mismatch
  3. [3] § 4. Methods › 4.5. Experiments › 4.5.1. Methodological configurations. ↔ temp_backup/src/embedding.py, the whole file · a weak match · score 0.61 · embedding network, NPE LSTM, bidirectional, dropout, hidden, layer · block oscr:b:6SVMX0WCRNKHV-R · Report a mismatch
  4. [4] § 4. Methods › 4.2. Simulation-based inference › 4.2.3. Neural Posterior Estimation with temporal embedding (NPE-LSTM). ↔ temp_backup/src/embedding.py, the whole file · a weak match · score 0.60 · fully connected, embedding network, NPE, LSTM · block oscr:b:6SVMX0WCRNKHV-R · Report a mismatch
  5. [5] § 4. Methods › 4.5. Experiments › 4.5.2. Computational environment. ↔ temp_backup/src/utils.py, lines 8 to 27 · score 0.53 · PyTorch, Python, reproducibility, NumPy · block oscr:b:E3MR70QXKD596-N · Report a mismatch
  6. [6] § 4. Methods › 4.4. Performance metrics › 4.4.5. Computational runtime. ↔ temp_backup/src/inference.py, lines 139 to 174 · score 0.52 · generating simulated, refines, NPE LSTM, SMC, preconditioning, populations · block oscr:b:BQHFDZB63QJY3-Y · Report a mismatch
  7. [7] § 4. Methods › 4.4. Performance metrics › 4.4.2. Quantitative metrics. ↔ episbi/metric.py, lines 139 to 175 · score 0.51 · weighted interval score, MAE, coverage, metrics, error · block oscr:b:YAQ0EN4NTJK9F-3 · Report a mismatch

Paper

Loaded from Europe PMC by your browser; OSCR does not store it: doi.org · Europe PMC

The paper is loaded when this pane is shown.

The authors' code

Python · 174 lines · 6.8 KB · no license · 2 matches

  1. import torch
  2. import torch.nn as nn
  3. import pyabc
  4. import tempfile
  5. from sbi.inference import NPE
  6. from sbi.neural_nets import posterior_nn
  7. from .embedding import LSTMembedding
  8. from .distance import euclidean_distance
  9. class SBIEngine:
  10. """
  11. Unified Inference Engine for Epidemic Models.
  12. Provides three main methods: run_abc, run_npe, and run_pnpe.
  13. """
  14. def __init__(self, density_estimator='maf', device='cpu', batch_size=256):
  15. """
  16. Initialize the inference engine.
  17. Args:
  18. density_estimator (str): Type of flow-based model ('maf' or 'nsf').
  19. device (str): Device for neural network training ('cpu' or 'cuda').
  20. batch_size (int): Batch size for NPE training.
  21. low (list): Lower bounds for uniform prior.
  22. high (list): Upper bounds for uniform prior.
  23. """
  24. self.de_type = density_estimator
  25. self.device = device
  26. self.batch_size = batch_size
  27. def _get_neural_net(self, use_embedding=False, input_dim=1):
  28. """Builds the neural posterior architecture (MAF/NSF) with optional
  29. LSTM embedding."""
  30. embedding_net = (LSTMembedding(input_dim=input_dim).to(self.device)
  31. if use_embedding else nn.Identity())
  32. return posterior_nn(
  33. model=self.de_type,
  34. embedding_net=embedding_net
  35. )
  36. def run_abc(self, obs_data, prior, simulator_func, distance=None,
  37. num_simulations=10000, population_size=1000,
  38. num_samples=10000):
  39. """
  40. Runs Approximate Bayesian Computation (ABC) with SMC.
  41. Args:
  42. obs_data (dict): Observed data in dictionary format
  43. (e.g.,{"data":array}).
  44. prior: pyabc.Distribution object.
  45. simulator_func: Simulator function returning a dictionary.
  46. num_simulations (int): Total simulation budget.
  47. population_size (int): Size of the ABC population.
  48. num_samples (int): Number of samples to draw from the posterior.
  49. """
  50. print("[*] Running SMC-ABC...")
  51. if distance is None:
  52. distance = euclidean_distance
  53. if not isinstance(obs_data, dict):
  54. obs_data = {"data": obs_data}
  55. def simulator_pyabc(x):
  56. return {"data": simulator_func(x)}
  57. # Configure Epsilon and Transition as requested
  58. eps = pyabc.QuantileEpsilon(initial_epsilon='from_sample', alpha=0.2)
  59. transition = pyabc.MultivariateNormalTransition(scaling=0.5)
  60. abc = pyabc.ABCSMC(
  61. simulator_pyabc,
  62. prior,
  63. distance,
  64. eps=eps,
  65. transitions=transition,
  66. population_size=population_size
  67. )
  68. db_path = "sqlite:///" + tempfile.mkstemp(suffix=".db")[1]
  69. abc.new(db_path, obs_data)
  70. history = abc.run(max_total_nr_simulations=num_simulations)
  71. # Draw samples from the posterior distribution
  72. df, weights = history.get_distribution()
  73. kde = pyabc.transition.MultivariateNormalTransition()
  74. kde.fit(df, weights)
  75. return kde.rvs(num_samples)
  76. def run_npe(self, obs_data, prior=None, thetas=None, xs=None,
  77. use_lstm=False, input_dim=1,
  78. learning_rate=0.001, num_samples=10000, batch_size=256):
  79. """
  80. Runs Neural Posterior Estimation (NPE).
  81. Args:
  82. prior: sbi prior object.
  83. thetas (Tensor): Simulated parameters.
  84. xs (Tensor): Simulated trajectories.
  85. use_lstm (bool): Whether to use LSTM embedding (NPE-LSTM).
  86. learning_rate (float): Optimizer learning rate.
  87. num_samples (int): Number of samples to draw from the posterior.
  88. batch_size (int or None): Training batch size.
  89. """
  90. batch_size = batch_size if batch_size is not None else self.batch_size
  91. print(f"[*] Running NPE (use_lstm={use_lstm}) with batch size "
  92. f"{batch_size}...")
  93. # 1. Handle Observation Data (Convert to Tensor)
  94. if isinstance(obs_data, dict):
  95. x_obs = torch.tensor(obs_data["data"], dtype=torch.float32).to(self.device)
  96. else:
  97. x_obs = torch.tensor(obs_data, dtype=torch.float32).to(self.device)
  98. # 2. Normalization Logic (Z-score)
  99. if xs.dim() >= 2:
  100. # Calculate stats along the batch and sequence dimensions
  101. mean_xs = xs.mean(dim=0, keepdim=True)
  102. std_xs = xs.std(dim=0, keepdim=True) + 1e-6
  103. xs = (xs - mean_xs) / std_xs
  104. x_obs = (x_obs - mean_xs.squeeze(0)) / std_xs.squeeze(0)
  105. # 3. Setup and Train
  106. neural_net = self._get_neural_net(use_embedding=use_lstm,
  107. input_dim=input_dim)
  108. inference = NPE(prior=prior, density_estimator=neural_net,
  109. device=self.device)
  110. density_estimator = inference.append_simulations(thetas, xs).train(
  111. training_batch_size=batch_size,
  112. learning_rate=learning_rate,
  113. show_train_summary=True
  114. )
  115. posterior = inference.build_posterior(density_estimator)
  116. samples = posterior.sample((num_samples,), x=x_obs)
  117. return posterior, samples
  118. def run_pnpe(self, obs_data, pyabc_prior, sbi_prior, simulator_func,
  119. num_simulations=10000, num_samples=10000, batch_size=256):
  120. """
  121. Runs Preconditioned Neural Posterior Estimation (PNPE).
  122. Stage 1: ABC-SMC preconditioning to narrow parameter space.
  123. Stage 2: Training NPE on the refined region.
  124. """
  125. print("[*] PNPE Stage 1: ABC Preconditioning...")
  126. # Step 1: Rapid ABC-SMC to find the high-probability region
  127. refined_thetas = self.run_abc(
  128. obs_data,
  129. pyabc_prior,
  130. simulator_func,
  131. num_simulations=num_simulations//2,
  132. population_size=100,
  133. num_samples=num_simulations//2
  134. )
  135. print("[*] PNPE Stage 2: Training NPE with preconditioned samples...")
  136. thetas_t = torch.tensor(refined_thetas.values, dtype=torch.float32)
  137. # Generate simulations for the refined parameters
  138. xs_list = []
  139. for i, p in refined_thetas.iterrows():
  140. sim_res = simulator_func(p)
  141. xs_list.append(torch.tensor(sim_res, dtype=torch.float32))
  142. xs_t = torch.stack(xs_list)
  143. # Step 2: Train NPE (NPE-LSTM is standard for PNPE)
  144. _, samples = self.run_npe(obs_data, sbi_prior, thetas_t, xs_t,
  145. use_lstm=True, num_samples=num_samples,
  146. batch_size=batch_size)
  147. return samples

inference.py at commit 4b03ef1, no license · at the source

Overview

Authors: Geunsoo Jang1, K Selçuk Candan1, Gerardo Chowell2,3
ORCID iDs: Geunsoo Jang
  1. School of Computing and Augmented Intelligence, Arizona State University, Tempe, Arizona, United States of America
  2. Department of Population Health Sciences, School of Public Health, Georgia State University, Atlanta, Georgia, United States of America
  3. Department of Applied Mathematics, Kyung Hee University, Yongin, Korea
Institutions: Arizona State University (United States); Georgia State University (United States); Kyung Hee University (South Korea)
Journal: PLoS computational biology, volume 22, issue 6, article e1014364
Dates: received 16 October 2025; accepted 26 May 2026; published online 2 June 2026
Type: Research article · Language: English
License: CC BY
Identifiers: DOI 10.1371/journal.pcbi.1014364 · PMID 42228739 · PMCID PMC13252848 · OpenAlex W7163199700
Open access: gold, a free copy (OpenAlex)
Status: code verified (how the code is found and verified)
Categories: computational modeling (no new data) (modality), human (organism), computational (subfield)
Methods: Graphs, Machine learning
MeSH: Computer Simulation*, Epidemics*, Epidemiological Models*, Models, Biological*, Algorithms, Bayes Theorem, Computational Biology, Humans, Likelihood Functions (* major topic)
Topic: COVID-19 epidemiological studies (Modeling and Simulation, Mathematics), according to OpenAlex
Funding: National Science Foundation (2412115, 2435886)
Citations: not cited yet (Europe PMC); 60 references in the paper

Abstract

Epidemic models play a critical role in understanding transmission dynamics, generating forecasts, and informing public health interventions when they are properly calibrated to epidemiological data. Traditional Bayesian inference methods rely on the likelihood function to update prior knowledge using observed data. However, for realistic epidemic models, likelihood functions are often analytically intractable or computationally prohibitive, which can limit the applicability of these methods. Simulation-based inference provides a promising alternative by approximating posterior distributions through forward simulations rather than an explicit likelihood evaluation. In this study, we present a systematic comparison of four approaches: Approximate Bayesian Computation (ABC), Neural Posterior Estimation (NPE), a neural method with temporal embedding, and Preconditioned Neural Posterior Estimation (PNPE), which integrates elements of both classical and neural techniques. These methods are evaluated across epidemic models of increasing complexity under fixed simulation budgets and varying levels of observational noise, with explicit attention to both structural and practical identifiability. Our results show that neural methods generally improve posterior fidelity and predictive accuracy compared with ABC under constrained simulation budgets. PNPE achieved strong performance in several simulation settings, whereas temporal embeddings improved inference in models with complex epidemic dynamics by capturing sequential dependencies. These gains come with important trade-offs: PNPE required substantially greater computational resources and, unlike fully amortized NPE-based methods, may require reconditioning for each new observation. In contrast, ABC remained computationally efficient and provided reasonable, though often more conservative, posterior estimates. Overall, our findings highlight trade-offs among computational efficiency, posterior accuracy, uncertainty calibration, and inference reusability, suggesting that method selection should depend on model complexity, data quality, identifiability, and available computational resources.

Reproduced under the paper's license (CC BY), from the paper cited above.

Repository

Its files are read in the Code ↔ Paper reader above, with 7 matches between paragraphs and lines of code.

geunsoojang/EpiSBI

License: none: the authors keep all their rights
State: the link answers, verified on 27 September 2026
Evidence: files inventoried
Commit: 4b03ef1342fb10f2e3f47f275a3d05f16750682d, 5 August 2026
Languages: Jupyter (37), Python (25)
Size: 81 files, 62 scripts
Software Heritage: not archived
Found in: “Data Availability”
Holds: README, environment (pyproject.toml, requirements.txt), 37 notebooks
Not found: license file, CITATION.cff, tests, continuous integration, documentation
Tools: NumPy (54 files), pandas (36 files), Matplotlib (31 files), PyTorch (26 files), SciPy (22 files), SymPy (4 files), h5py (1 file), Numba (1 file), scikit-learn (1 file)
Availability: 1 check, the latest on 27 September 2026: the link answers
  • 27 September 2026: the link answers
63 files

The paper's code and data availability statement is in the Data section.

Tracing map

Proposed by the machine: these links were found in the paper and verified at the source, without human review. The map will receive a Zenodo DOI once one of the paper's authors has validated it with their ORCID.

What the map holds:

  • 1 repository of the authors' code, each at its verified commit, with its license and how the link was found in the paper;
  • 62 scripts, each with its path and the digest of its content;
  • 7 matches between paragraphs of the paper and lines of the code (method lexical-v1);
  • neither the text of the paper nor the code itself.

Its JSON (tracing-map.json) is deposited on Zenodo with its DOI once the map is validated.

Data

No dataset and no data link were found in the paper.

Data Availability

All data and code used in this study are publicly available in an online repository. The code and processed datasets can be accessed at: https://github.com/geunsoojang/EpiSBI.

Reproduced under the paper's license (CC BY), from the paper cited above.

Versions

The history of this record: each version stored by the harvester or made by a correction of its authors or of the maintainers of its code, and what changed in its facts. The texts of the paper (its abstract, its availability statements) are not part of it; versions that changed only those are not listed.

Version 1, 27 September 2026: the first record

Recorded: type, language, journal, volume, issue, pages, dates, 3 authors, 9 MeSH terms, 1 funder, 37 references.

Cite

This paper

Jang, G., Candan, K. S., & Chowell, G. (2026). A comparative study of simulation-based inference methods for epidemic models with identifiability considerations. PLoS computational biology, 22(6), e1014364. https://doi.org/10.1371/journal.pcbi.1014364

BibTeX

@article{jang2026comparative,
author = {Jang, Geunsoo and Candan, K Selçuk and Chowell, Gerardo},
title = {{A comparative study of simulation-based inference methods for epidemic models with identifiability considerations}},
journal = {PLoS computational biology},
year = {2026},
month = jun,
volume = {22},
number = {6},
pages = {e1014364},
publisher = {PLOS},
issn = {1553-734X},
doi = {10.1371/journal.pcbi.1014364},
url = {https://doi.org/10.1371/journal.pcbi.1014364},
pmid = {42228739},
pmcid = {PMC13252848}
}

RIS

TY - JOUR
AU - Jang, Geunsoo
AU - Candan, K Selçuk
AU - Chowell, Gerardo
TI - A comparative study of simulation-based inference methods for epidemic models with identifiability considerations
T2 - PLoS computational biology
J2 - PLoS Comput Biol
PY - 2026
DA - 2026/06/02
VL - 22
IS - 6
SP - e1014364
SN - 1553-734X
PB - PLOS
DO - 10.1371/journal.pcbi.1014364
UR - https://doi.org/10.1371/journal.pcbi.1014364
LA - en
ER -

CSL-JSON

{
"id": "10.1371/journal.pcbi.1014364",
"type": "article-journal",
"title": "A comparative study of simulation-based inference methods for epidemic models with identifiability considerations",
"container-title": "PLoS computational biology",
"author": [
{
"family": "Jang",
"given": "Geunsoo"
},
{
"family": "Candan",
"given": "K Selçuk"
},
{
"family": "Chowell",
"given": "Gerardo"
}
],
"container-title-short": "PLoS Comput Biol",
"volume": "22",
"issue": "6",
"page": "e1014364",
"DOI": "10.1371/journal.pcbi.1014364",
"PMID": "42228739",
"PMCID": "PMC13252848",
"ISSN": "1553-734X",
"publisher": "PLOS",
"URL": "https://doi.org/10.1371/journal.pcbi.1014364",
"language": "en",
"issued": {
"date-parts": [
[
2026,
6,
2
]
]
}
}

The tracing map gets a citation of its own once an author has validated it and it has a DOI.

Similar papers

The papers with a page that share the most with this one: the tools found in their code, their categories, datasets, cited references and authors, the rarest counting most.

[1] doi:10.7554/elife.106194 [code]
Virtual Brain Inference (VBI), a flexible and integrative toolkit for efficient probabilistic inference on whole-brain models.
Journal: eLife
In common: Numba, PyTorch, scikit-learn, 4 other tools, computational, computational modeling (no new data), 4 references
[2] doi:10.1098/rsif.2024.0880 [code]
Dynamic causal modelling in probabilistic programming languages.
Journal: Journal of the Royal Society, Interface
In common: Numba, PyTorch, pandas, 3 other tools, computational, 3 references
[3] doi:10.1371/journal.pcbi.1011406 [code]
Simulation-based inference for efficient identification of generative models in computational connectomics.
Journal: PLoS computational biology
In common: PyTorch, scikit-learn, pandas, 3 other tools, computational, computational modeling (no new data), 3 references
[4] doi:10.1038/s41598-023-40278-3 [code]
Neural superstatistics for Bayesian estimation of dynamic cognitive models.
Journal: Scientific reports
In common: SymPy, Numba, scikit-learn, 4 other tools, 2 references
[5] doi:10.1038/s42003-025-08971-3 [code]
Probabilistic inference of social presence across brain scales reveals enhanced synaptic efficacy.
Journal: Communications biology
In common: Numba, PyTorch, scikit-learn, 4 other tools, computational modeling (no new data), 2 references
[6] doi:10.1038/s41540-025-00516-y [code]
The Virtual Parkinsonian patient.
Journal: NPJ systems biology and applications
In common: SymPy, Numba, PyTorch, 5 other tools, 1 reference
[7] doi:10.7554/elife.77220 [code]
Flexible and efficient simulation-based inference for models of decision-making.
Journal: eLife
In common: PyTorch, scikit-learn, pandas, 3 other tools, computational modeling (no new data), 3 references
[8] doi:10.1021/acs.jcim.5c01888 [code]
CANDID-CNS: AI Unlocks Stereochemistry and Beyond Rule of 5 to Predict CNS Penetration of Small Molecules.
Journal: Journal of chemical information and modeling
In common: SymPy, Numba, h5py, 6 other tools
[9] doi:10.1038/s41587-022-01455-3 [code]
Scalable in situ single-cell profiling by electrophoretic capture of mRNA using EEL FISH.
Journal: Nature biotechnology
In common: SymPy, Numba, h5py, 6 other tools
[10] doi:10.1016/j.neuron.2025.08.030 [code]
Ultra-high-density Neuropixels probes improve detection and identification in neuronal recordings.
Journal: Neuron
In common: SymPy, Numba, h5py, 6 other tools

Contribute

The authors of this paper can claim it, correct its record and validate its tracing map, and the maintainers of its code (its owner, or a public member of its organization) correct what it says of their repository; anyone signed in can ask for its removal. Every request goes to OSCR's own machine, which answers it; your account page follows them.

Sign in with ORCID to claim this paper as one of its authors, correct its record or validate its tracing map: when the paper's metadata lists your ORCID iD, you are recognized at once. Maintainers of its code: sign in with GitHub, then claim the repository on your account page.

Add the badge to the code's README

OSCR: the badge of this paper

If you are an author or a maintainer of this paper's code, you can add this badge. It says what OSCR knows of the paper (its code, its validated tracing map) and links the code to this page. Paste one of these snippets under the README's title. Keep the two marks around it, so that the badge can be replaced in place and is never added twice. OSCR changes nothing in your repository.

Markdown
<!-- oscr-badge:start -->
[![OSCR](https://openscicode.org/badge/doi/10.1371/journal.pcbi.1014364.svg)](https://openscicode.org/badge/doi/10.1371/journal.pcbi.1014364)
<!-- oscr-badge:end -->
reStructuredText
.. oscr-badge:start

.. image:: https://openscicode.org/badge/doi/10.1371/journal.pcbi.1014364.svg
   :target: https://openscicode.org/badge/doi/10.1371/journal.pcbi.1014364
   :alt: OSCR

.. oscr-badge:end
HTML
<!-- oscr-badge:start -->
<a href="https://openscicode.org/badge/doi/10.1371/journal.pcbi.1014364"><img src="https://openscicode.org/badge/doi/10.1371/journal.pcbi.1014364.svg" alt="OSCR"></a>
<!-- oscr-badge:end -->

On GitHub, open the README, choose Edit (the pencil), paste the snippet under the title, then "Commit changes".

If you choose to, you can have the badge kept up to date for you, with oscr badge --write from the command line or with the GitHub Action in your repository's workflows. Every other form and option (a card, AsciiDoc, LaTeX, shields.io) is on the badge page.

Request its removal

To ask OSCR to remove this record, the copies of its authors' scripts or its tracing map, use the removal request page: signed in, you say who you are, what to remove and why, then review and confirm the request. Published rules decide every request (how).

Discussion, reproductions, activity

Discussion: code errors and mismatches between the code and the paper about this paper and its code, from readers and its authors, beside the paper and its tracing map.

Report a mismatch between the code and the paper · Report a code error (signed in)

Reproductions: reports from readers who ran the authors' code and did not get the paper's result, what they ran, with which environment, commit and data.

Report a reproduction failure (signed in)

Versions of its code: the releases of its code tied to a version of this paper (the preprint, the accepted manuscript, the version of record…), each with the tracing map versioned with it.

Activity: what happens around this paper: new versions of its record, its map's validation, discussions and reproductions. It opens with sign-in.