https://github.com/zebraalgebra/flusim
Repo for python package flusim (uploaded to testpypi)
https://github.com/zebraalgebra/flusim
markov-chain python simulation testpypi
Last synced: 3 months ago
JSON representation
Repo for python package flusim (uploaded to testpypi)
- Host: GitHub
- URL: https://github.com/zebraalgebra/flusim
- Owner: ZebraAlgebra
- License: mit
- Created: 2023-12-02T03:20:09.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-12-04T22:15:36.000Z (over 1 year ago)
- Last Synced: 2024-12-30T00:37:44.021Z (5 months ago)
- Topics: markov-chain, python, simulation, testpypi
- Language: HTML
- Homepage: https://test.pypi.org/project/flusim/
- Size: 12.9 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# flusim
## Overview
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
```bash
pip install -i https://test.pypi.org/simple/ flusim
```To customize upon this package, clone this repository, and run:
```bash
python setup.py bdist_wheel sdist
pip install .
```## Usage
For usage, please refer to this [link](https://github.com/ZebraAlgebra/flusim/blob/main/app/README.md).
For a demo, you may refer to this [Jupyter notbook](https://github.com/ZebraAlgebra/flusim/blob/main/notebooks/package_demo.ipynb) or preview the [generated HTML file](https://htmlpreview.github.io/?https://github.com/ZebraAlgebra/flusim/blob/main/notebooks/package_demo.html).
## Problem Definition
The **flu-spread problem** is defined as follows.
Suppose inside a closed environment, there are:1. `n + 1` people in it, labeled `0, 1, ..., n`
2. no people sick before day `0`, and `k` people
sick at day `0`
3. on each day, a sick person has a probability `p`
contaminating a healthy person
4. these events are independent
5. each person once get sick, will get healthy after
precisely `l` daysthen the problem is to calculate the expectation, variance of:
1. the end date of flu
2. the number of sick people in each dayThis problem can be formulated as a Markov process, and simulations, solvers can be designed to solve this question.