Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

Epidemiological Models

БесплатноБез исполняемых скриптовНе проверен

Guide for building, simulating, and analyzing epidemiological models with the epimodels Python library. Covers choosing built-in models (SIR, SEIR, SEQIAHR…

fccoelhoот fccoelho292 установки в других каталогах

Об этом скилле

Epidemiological Modeling with epimodels

Practical guide for the epimodels library (Python >= 3.12). It provides deterministic models in continuous (ODE) and discrete (difference-equation) time, stochastic CTMC models, network models, SDEs, fitting/inference, and symbolic analysis.

Quick Reference

Import Map

Task Import
Continuous models from epimodels.continuous.models import SIR, SEIR, ... (also from epimodels.continuous import SIR)
Discrete models from epimodels.discrete.models import SIR, SEIR, Influenza, ...
CTMC models from epimodels.stochastic.CTMC import SIR, ...
Network models from epimodels.network import NetworkSIR, NetworkSIS
Model registry from epimodels import get_model, list_models
Solvers from epimodels.solvers import ScipySolver, DiffraxSolver
Fitting (MLE) from epimodels.fitting import fit_model, Dataset, ModelFitter, ParameterSpec
Fitting (Bayes) from epimodels.fitting.bayes import fit_model_bayesian
Interventions from epimodels.interventions import Intervention, Scenario, ScenarioComparison
Ensembles from epimodels.ensembles import simulate_ensemble
SDE from epimodels.sde import SDEModel
Rt estimation from epimodels.rt import estimate_rt
Serialization from epimodels.io import save_model, load_model
Symbolic analysis from epimodels.validation import SymbolicModel
Phase space from epimodels.tools.phase import TimeDelayEmbedding, phase_portrait, find_optimal_embedding

Decision Guide: Which Model Family?

Situation Use
Fast deterministic scenario exploration Continuous ODE (epimodels.continuous)
Data reported at fixed intervals (daily/weekly), simple setup Discrete (epimodels.discrete)
Small populations, extinction/stochastic effects matter CTMC Gillespie (epimodels.stochastic.CTMC)
Explicit contact structure / heterogeneity Network (NetworkSIR, NetworkSIS)
Demographic noise around ODE dynamics, many trajectories SDE (SDEModel, requires [jax] extra)
Parameter uncertainty propagation Ensembles (simulate_ensemble)

1. Built-in Models

Discover models programmatically — prefer this over hardcoding lists:

from epimodels import get_model, list_models

print(list_models())                      # {'continuous': [...], 'discrete': [...], ...}
SIR = get_model("SIR", family="continuous")  # returns the CLASS, not an instance
model = SIR()

Continuous: SIR, SIS, SIRS, SEIR, SEQIAHR (COVID-like, 8 compartments), Dengue4Strain (49 compartments), SIR2Strain, SIRSEI/SIRSEIData (malaria, climate-forced), SEIRS_SEI (vector-borne), SIRSNonAutonomous (time-dependent params as callables), NeipelHeterogeneousSIR, EbolaSEIHFRV, SIR1D, SISLogistic.

Discrete: SIR, SIS, SIRS, SEIR, SEIS, SIpRpS, SIpR, SEIpRpS, SEIpR, SEQIAHR, Influenza (age-structured, 20 compartments).

Before writing a custom model, check whether a built-in fits — inspect model.state_variables, model.parameters, and repr(model) (renders a Mermaid flow diagram) to see its structure.

2. Simulation

Continuous (ODE)

from epimodels.continuous import SIR

model = SIR()
model(
    [990, 10, 0],          # inits, ordered per model.state_variables
    [0, 100],              # trange [t0, tf]
    1000,                  # totpop (injected into params as "N")
    {"beta": 0.3, "gamma": 0.1},
    t_eval=None,           # optional output time grid
    solver=None,           # optional ScipySolver/DiffraxSolver
)
model.plot_traces()        # or plot_traces(["I"])
print(model.R0)            # beta/gamma for mixin models; None before params set
print(model.summary())     # peak_I, peak_time, final_S, final_R, attack_rate, duration
df = model.to_dataframe()  # requires epimodels[dataframe]
  • Traces land in model.traces (keys = state variable names + "time").
  • model.simulate(...) is a chaining alias that returns the model.
  • Params must cover all model parameters; missing ones raise epimodels.exceptions.ValidationError. All values must be non-negative.
  • Sum of inits must not exceed totpop (small tolerance allowed).
  • Non-autonomous models (SIRSNonAutonomous) accept callables for parameters.

Solver Backends

from epimodels.solvers import ScipySolver, DiffraxSolver

model = SIR()
model([990, 10, 0], [0, 100], 1000, {"beta": 0.3, "gamma": 0.1},
      solver=ScipySolver(method="LSODA"))
# GPU/JAX (pip install epimodels[jax]):
model([990, 10, 0], [0, 100], 1000, {"beta": 0.3, "gamma": 0.1},
      solver=DiffraxSolver(solver="Tsit5", rtol=1e-6, atol=1e-9))
Scenario Solver
General use / stiff auto-detect ScipySolver("LSODA")
Stiff systems ScipySolver("BDF") or ("Radau")
High accuracy ScipySolver("DOP853")
Batch/parameter sweeps `DiffraxSo
Полный SKILL.md на ClawHub

Установить Epidemiological Models в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

FAQ

Что делает скилл Epidemiological Models?

Guide for building, simulating, and analyzing epidemiological models with the epimodels Python library. Covers choosing built-in models (SIR, SEIR, SEQIAHR, multi-strain, vector-borne...), writing custom models, ODE/discrete/CTMC/SDE/network simulation, solver backends, parameter fitting (MLE and Bayesian DE-MCMC), R0 and symbolic analysis, Rt estimation, intervention scenarios, uncertainty ensembles, and model serialization. Use when: creating epidemic models, simulating disease dynamics, fitting models to incidence data, estimating R0/Rt, running intervention scenarios, uncertainty/bayesian analysis, or debugging epimodels code.

Как установить скилл Epidemiological Models?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл Epidemiological Models запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить Epidemiological Models с