Workflow¶
High-level pipeline:
Define YAML → Generate ODEs → Simulate → Add Noise → Subset → Fit Parameters → Visualize & Diagnose
Steps¶
- Define YAML: create a model block with compartments, parameters, transitions, population, and initial conditions.
- Generate ODEs: the framework parses
transitions
into symbolic rates and constructs the right-hand side of the ODE system automatically. - Simulate: integrate the ODE system (default:
scipy.integrate.odeint
) over the time gridt = 0..days
. - Add Noise: Gaussian noise is added to simulated trajectories and clipped to valid ranges.
- Subset Sampling: sample a fraction of time points (
subset_ratio
) to mimic sparse observations. - Fit Parameters: minimize a loss function (default MSE over specified compartments) using chosen optimizers. Optionally run MCMC for posterior estimation.
- Visualize: produce trajectory plots, loss landscape, and posterior corner plots.
CLI / Script Example¶
Run a specific model (defined in your YAML configuration) by name:
python main.py --model SIR_model
After running, you’ll find all outputs in the plots/<model_name>/
folder.