A comparative study of simulation-based inference methods for epidemic models with identifiability considerations.
The 7 matches · 2 of them tie a paragraph to a whole file, not to given lines: weak matches, whose lines are not tinted
- [1] § 4. Methods › 4.5. Experiments › 4.5.1. Methodological configurations. ↔ temp_backup/src/inference.py, lines 40–87 · score 0.72 · Euclidean distance, quantile epsilon, simulation budgets, configuration, population, ABC
- [2] § 4. Methods › 4.5. Experiments › 4.5.1. Methodological configurations. ↔ temp_backup/src/distance.py, lines 4–17 · score 0.64 · L2 norm, Euclidean distance, trajectories, epidemic, simulation
- [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
- [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
- [5] § 4. Methods › 4.5. Experiments › 4.5.2. Computational environment. ↔ temp_backup/src/utils.py, lines 8–27 · score 0.53 · PyTorch, Python, reproducibility, NumPy
- [6] § 4. Methods › 4.4. Performance metrics › 4.4.5. Computational runtime. ↔ temp_backup/src/inference.py, lines 139–174 · score 0.52 · generating simulated, refines, NPE LSTM, SMC, preconditioning, populations
- [7] § 4. Methods › 4.4. Performance metrics › 4.4.2. Quantitative metrics. ↔ episbi/metric.py, lines 139–175 · score 0.51 · weighted interval score, MAE, coverage, metrics, error
Paper
Loaded from Europe PMC by your browser, not stored by OSCR: 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
- import torch
- import torch.nn as nn
- import pyabc
- import tempfile
- from sbi.inference import NPE
- from sbi.neural_nets import posterior_nn
- from .embedding import LSTMembedding
- from .distance import euclidean_distance
- class SBIEngine:
- """
- Unified Inference Engine for Epidemic Models.
- Provides three main methods: run_abc, run_npe, and run_pnpe.
- """
- def __init__(self, density_estimator='maf', device='cpu', batch_size=256):
- """
- Initialize the inference engine.
- Args:
- density_estimator (str): Type of flow-based model ('maf' or 'nsf').
- device (str): Device for neural network training ('cpu' or 'cuda').
- batch_size (int): Batch size for NPE training.
- low (list): Lower bounds for uniform prior.
- high (list): Upper bounds for uniform prior.
- """
- self.de_type = density_estimator
- self.device = device
- self.batch_size = batch_size
- def _get_neural_net(self, use_embedding=False, input_dim=1):
- """Builds the neural posterior architecture (MAF/NSF) with optional
- LSTM embedding."""
- embedding_net = (LSTMembedding(input_dim=input_dim).to(self.device)
- if use_embedding else nn.Identity())
- return posterior_nn(
- model=self.de_type,
- embedding_net=embedding_net
- )
- def run_abc(self, obs_data, prior, simulator_func, distance=None,
- num_simulations=10000, population_size=1000,
- num_samples=10000):
- """
- Runs Approximate Bayesian Computation (ABC) with SMC.
- Args:
- obs_data (dict): Observed data in dictionary format
- (e.g.,{"data":array}).
- prior: pyabc.Distribution object.
- simulator_func: Simulator function returning a dictionary.
- num_simulations (int): Total simulation budget.
- population_size (int): Size of the ABC population.
- num_samples (int): Number of samples to draw from the posterior.
- """
- print("[*] Running SMC-ABC...")
- if distance is None:
- distance = euclidean_distance
- if not isinstance(obs_data, dict):
- obs_data = {"data": obs_data}
- def simulator_pyabc(x):
- return {"data": simulator_func(x)}
- # Configure Epsilon and Transition as requested
- eps = pyabc.QuantileEpsilon(initial_epsilon='from_sample', alpha=0.2)
- transition = pyabc.MultivariateNormalTransition(scaling=0.5)
- abc = pyabc.ABCSMC(
- simulator_pyabc,
- prior,
- distance,
- eps=eps,
- transitions=transition,
- population_size=population_size
- )
- db_path = "sqlite:///" + tempfile.mkstemp(suffix=".db")[1]
- abc.new(db_path, obs_data)
- history = abc.run(max_total_nr_simulations=num_simulations)
- # Draw samples from the posterior distribution
- df, weights = history.get_distribution()
- kde = pyabc.transition.MultivariateNormalTransition()
- kde.fit(df, weights)
- return kde.rvs(num_samples)
- def run_npe(self, obs_data, prior=None, thetas=None, xs=None,
- use_lstm=False, input_dim=1,
- learning_rate=0.001, num_samples=10000, batch_size=256):
- """
- Runs Neural Posterior Estimation (NPE).
- Args:
- prior: sbi prior object.
- thetas (Tensor): Simulated parameters.
- xs (Tensor): Simulated trajectories.
- use_lstm (bool): Whether to use LSTM embedding (NPE-LSTM).
- learning_rate (float): Optimizer learning rate.
- num_samples (int): Number of samples to draw from the posterior.
- batch_size (int or None): Training batch size.
- """
- batch_size = batch_size if batch_size is not None else self.batch_size
- print(f"[*] Running NPE (use_lstm={use_lstm}) with batch size "
- f"{batch_size}...")
- # 1. Handle Observation Data (Convert to Tensor)
- if isinstance(obs_data, dict):
- x_obs = torch.tensor(obs_data["data"], dtype=torch.float32).to(self.device)
- else:
- x_obs = torch.tensor(obs_data, dtype=torch.float32).to(self.device)
- # 2. Normalization Logic (Z-score)
- if xs.dim() >= 2:
- # Calculate stats along the batch and sequence dimensions
- mean_xs = xs.mean(dim=0, keepdim=True)
- std_xs = xs.std(dim=0, keepdim=True) + 1e-6
- xs = (xs - mean_xs) / std_xs
- x_obs = (x_obs - mean_xs.squeeze(0)) / std_xs.squeeze(0)
- # 3. Setup and Train
- neural_net = self._get_neural_net(use_embedding=use_lstm,
- input_dim=input_dim)
- inference = NPE(prior=prior, density_estimator=neural_net,
- device=self.device)
- density_estimator = inference.append_simulations(thetas, xs).train(
- training_batch_size=batch_size,
- learning_rate=learning_rate,
- show_train_summary=True
- )
- posterior = inference.build_posterior(density_estimator)
- samples = posterior.sample((num_samples,), x=x_obs)
- return posterior, samples
- def run_pnpe(self, obs_data, pyabc_prior, sbi_prior, simulator_func,
- num_simulations=10000, num_samples=10000, batch_size=256):
- """
- Runs Preconditioned Neural Posterior Estimation (PNPE).
- Stage 1: ABC-SMC preconditioning to narrow parameter space.
- Stage 2: Training NPE on the refined region.
- """
- print("[*] PNPE Stage 1: ABC Preconditioning...")
- # Step 1: Rapid ABC-SMC to find the high-probability region
- refined_thetas = self.run_abc(
- obs_data,
- pyabc_prior,
- simulator_func,
- num_simulations=num_simulations//2,
- population_size=100,
- num_samples=num_simulations//2
- )
- print("[*] PNPE Stage 2: Training NPE with preconditioned samples...")
- thetas_t = torch.tensor(refined_thetas.values, dtype=torch.float32)
- # Generate simulations for the refined parameters
- xs_list = []
- for i, p in refined_thetas.iterrows():
- sim_res = simulator_func(p)
- xs_list.append(torch.tensor(sim_res, dtype=torch.float32))
- xs_t = torch.stack(xs_list)
- # Step 2: Train NPE (NPE-LSTM is standard for PNPE)
- _, samples = self.run_npe(obs_data, sbi_prior, thetas_t, xs_t,
- use_lstm=True, num_samples=num_samples,
- batch_size=batch_size)
- return samples
inference.py at commit 4b03ef1, no license · at the source
Overview
- School of Computing and Augmented Intelligence, Arizona State University, Tempe, Arizona, United States of America
- Department of Population Health Sciences, School of Public Health, Georgia State University, Atlanta, Georgia, United States of America
- Department of Applied Mathematics, Kyung Hee University, Yongin, Korea
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
4b03ef1342fb10f2e3f47f275a3d05f16750682d, 5 August 2026Availability: 1 check, the latest on 27 September 2026: the link answers
- 27 September 2026: the link answers
63 files
- episbi/
__init__.py , Python, 18 lines - episbi/
adjustment.py , Python, 81 lines - episbi/
embedding.py , Python, 24 lines - episbi/
forecasting.py , Python, 421 lines - episbi/
inference.py , Python, 517 lines - episbi/
metric.py , Python, 245 lines, 1 match - episbi/
models/ , Python, 23 lines__init__.py - episbi/
models/ , Python, 365 linescompartment.py - episbi/
models/ , Python, 105 linesdeterministic_seir.py - episbi/
models/ , Python, 146 linesstochastic_se1e2e3ir.py - episbi/
models/ , Python, 99 linesstochastic_seir.py - episbi/
models/ , Python, 105 linesstochastic_seird.py - episbi/
prior.py , Python, 97 lines - episbi/
simulation.py , Python, 147 lines - episbi/
utils.py , Python, 63 lines - notebooks/
Model1/ , Jupyter, 133 linesABC.ipynb - notebooks/
Model1/ , Jupyter, 104 linesNPE-LSTM.ipynb - notebooks/
Model1/ , Jupyter, 88 linesNPE.ipynb - notebooks/
Model1/ , Jupyter, 301 linesPNPE.ipynb - notebooks/
Model2/ , Jupyter, 163 linesABC.ipynb - notebooks/
Model2/ , Jupyter, 124 linesNPE-LSTM.ipynb - notebooks/
Model2/ , Jupyter, 99 linesNPE.ipynb - notebooks/
Model2/ , Jupyter, 205 linesPNPE.ipynb - notebooks/
Model2/ , Jupyter, 78 linesdata_generator.ipynb - notebooks/
Model3/ , Jupyter, 202 linesABC.ipynb - notebooks/
Model3/ , Python, 253 linesDDE_s.py - notebooks/
Model3/ , Python, 196 linesInfectionModel_s.py - notebooks/
Model3/ , Jupyter, 103 linesNPE-LSTM.ipynb - notebooks/
Model3/ , Jupyter, 86 linesNPE.ipynb - notebooks/
Model3/ , Jupyter, 496 linesPNPE.ipynb - notebooks/
Model3/ , Python, 85 linesParameters_s.py - notebooks/
Model3/ , Jupyter, 163 linesdata_generator.ipynb - temp_backup/
models/ , Python, 4 lines__init__.py - temp_backup/
models/ , Python, 22 linesepidemic_models.py - temp_backup/
src/ , Python, 7 lines__init__.py - temp_backup/
src/ , Python, 33 lines, 1 matchdistance.py - temp_backup/
src/ , Python, 41 lines, 2 matchesembedding.py - temp_backup/
src/ , Python, 174 lines, 2 matchesinference.py - temp_backup/
src/ , Python, 74 lines, 1 matchutils.py - temp_backup/
tutorial/ , Jupyter, 285 linesABC.ipynb - temp_backup/
tutorial/ , Jupyter, 169 linesModel1_ABC.ipynb - temp_backup/
tutorial/ , Jupyter, 185 linesModel1_NPE-LSTM.ipynb - temp_backup/
tutorial/ , Jupyter, 204 linesModel1_NPE.ipynb - temp_backup/
tutorial/ , Jupyter, 435 linesNPE-LSTM.ipynb - temp_backup/
tutorial/ , Jupyter, 382 linesNPE.ipynb - temp_backup/
tutorial/ , Jupyter, 309 linesPNPE.ipynb - temp_backup/
tutorial/ , Jupyter, 113 linesmain.ipynb - tutorials/
01-1_Deterministic_seir_ , Jupyter, 96 linesmodel.ipynb - tutorials/
01-2_Stochastic_seir_mod , Jupyter, 68 linesel.ipynb - tutorials/
02-1_ABC_deterministic_s , Jupyter, 161 lineseir.ipynb - tutorials/
02-2_NPE_deterministic_s , Jupyter, 179 lineseir.ipynb - tutorials/
02-3_NPE_LSTM_determinis , Jupyter, 179 linestic_seir.ipynb - tutorials/
02-4_PNPE_deterministic_ , Jupyter, 177 linesseir.ipynb - tutorials/
03-1_ABC_stochastic_seir , Jupyter, 158 lines.ipynb - tutorials/
03-2_NPE_stochastic_seir , Jupyter, 182 lines.ipynb - tutorials/
03-3_NPE_LSTM_stochastic , Jupyter, 185 lines_seir.ipynb - tutorials/
03-4_PNPE_stochastic_sei , Jupyter, 162 linesr.ipynb - tutorials/
04-1_NPE_SEIAR.ipynb , Jupyter, 186 lines - tutorials/
04-2_NPE_SEIAR.ipynb , Jupyter, 187 lines - tutorials/
04-3_NPE_SEIRD.ipynb , Jupyter, 185 lines - tutorials/
05_Custom_model.ipynb , Jupyter, 289 lines - tutorials/
06_GPU.ipynb , Jupyter, 169 lines - README.md, Text, 226 lines
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://
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://
BibTeX
@article{jang2026compara
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/
url = {https://
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/
VL - 22
IS - 6
SP - e1014364
SN - 1553-734X
PB - PLOS
DO - 10.1371/
UR - https://
LA - en
ER -
CSL-JSON
{
"id": "10.1371/
"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":
"volume": "22",
"issue": "6",
"page": "e1014364",
"DOI": "10.1371/
"PMID": "42228739",
"PMCID": "PMC13252848",
"ISSN": "1553-734X",
"publisher": "PLOS",
"URL": "https://
"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.3758/s13428-026-03122-w [code]
- Modeling intraindividual variability in affect (MIVA): Formalized theoretical approach, computational model, and parameter recovery study.Journal: Behavior research methodsIn common: Numba, pandas, SciPy, 2 other tools, computational, computational modeling (no new data), 2 references
- [2] doi:10.1093/genetics/iyag107 [code]
- Neural posterior estimation for population genetics.Journal: GeneticsIn common: PyTorch, pandas, SciPy, 2 other tools, computational, 3 references
- [3] doi:10.1016/j.isci.2026.115488 [code]
- An integrated &
lt;i& gt;i& lt;/ i& gt; & lt;i& gt;n vitro& lt;/ i& gt; platform and biophysical modeling approach for studying synaptic transmission in isolated neuronal pairs. Journal: iScienceIn common: h5py, PyTorch, scikit-learn, 4 other tools, 2 references - [4] doi:10.1038/s43856-026-01606-6 [code]
- Validation of remote multimodal AI screening for Parkinson disease across diverse settings.Journal: Communications medicineIn common: SymPy, Numba, PyTorch, 5 other tools
- [5] doi:10.1371/journal.pcbi.1014283 [code]
- Spatial richness of neural magnetic fields.Journal: PLoS computational biologyIn common: SymPy, h5py, scikit-learn, 3 other tools, computational, computational modeling (no new data)
- [6] doi:10.1162/imag.a.1227 [code]
- Large language models reveal the neural tracking of linguistic context in attended and unattended multi-talker speech.Journal: Imaging neuroscience (Cambridge, Mass.)In common: SymPy, h5py, PyTorch, 5 other tools
- [7] doi:10.1371/journal.pcbi.1014337 [code]
- Fast reconstruction of degenerate populations of conductance-based neuron models from spike times.Journal: PLoS computational biologyIn common: PyTorch, scikit-learn, pandas, 3 other tools, computational, computational modeling (no new data), 1 reference
- [8] doi:10.7554/elife.110588 [code]
- Opening the black box toward a modular approach to spike sorting.Journal: eLifeIn common: Numba, h5py, PyTorch, 5 other tools
- [9] doi:10.1093/bioinformatics/btag540 [code]
- Deciphering spatial heterogeneity by multimodal spatial transcriptomics modelling with SpatialModal.Journal: Bioinformatics (Oxford, England)In common: Numba, h5py, PyTorch, 5 other tools
- [10] doi:10.1073/pnas.2533168123 [code]
- Dendritic morphology and synaptic nonlinearities enhance functional complexity in human cortical neurons.Journal: Proceedings of the National Academy of Sciences of the United States of AmericaIn common: Numba, h5py, PyTorch, 5 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.
Claim this paper
Correct its record
Say what each link of this record is, remove the ones that are not the paper's, add the ones that are missing. The correction becomes a new version of the record, in its Versions section.
Validate its tracing map
You validate the map as this page shows it: 1 repository of the authors' code, each at its verified commit and with its license, 62 scripts, and 7 matches between paragraphs and code (see the Code and Map sections). It then receives a DOI on Zenodo, with you (your ORCID iD) and OSCR as its creators; the code itself is not deposited.
The map's fingerprint: sha256:7299ba2113878026…
Add the badge to its README
The badge links the code to this page. Copy one of these into the README of the paper's code: only you decide where it goes, and nothing is changed for you.
Markdown
[, paste the snippet at the top, then “Commit changes…” and, to review it first, “Create a new branch and start a pull request”. You open the pull request; OSCR asks for no permission.
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: questions and error reports about this paper and its code, from signed-in readers and its authors. It opens with sign-in.
Reproductions: reports from readers who ran the authors' code: what they reproduced, with which environment, commit and data. It opens with sign-in.
Activity: what happens around this paper: new versions of its record, its map's validation, discussions and reproductions. It opens with sign-in.
