This repository holds the files for the flu-sim
Python package. This is a package used for simulating, calculating and visualizing some statistics related to a simple flu-spread problem.
For example, one can visualize a single flu spread:
or simulate a flu spread multiple times and plot the computed confidence intervals:
To use this package, run
pip install -i https://test.pypi.org/simple/ flusim
To customize upon this package, clone this repository, and run:
python setup.py bdist_wheel sdist
pip install .
For usage, please refer to this link.
For a demo, you may refer to this Jupyter notbook or preview the generated HTML file.
The flu-spread problem is defined as follows. Suppose inside a closed environment, there are:
n + 1
people in it, labeled0, 1, ..., n
- no people sick before day
0
, andk
people sick at day0
- on each day, a sick person has a probability
p
contaminating a healthy person - these events are independent
- each person once get sick, will get healthy after
precisely
l
days
then the problem is to calculate the expectation, variance of:
- the end date of flu
- the number of sick people in each day
This problem can be formulated as a Markov process, and simulations, solvers can be designed to solve this question.