Code Monkey home page Code Monkey logo

covid19-predict's Introduction

covid19-predict

A little python example that generates a graph showing multiple common prediction models

Common Models

Overview

This an example usage of common time series forecasting models, applied to COVID-19 data. The expected format is a *.csv file that looks like the following:

total_cum,total_recovered,total_deaths,date
1,0,0,3/16/20
2,1,0,3/17/20
4,1,1,3/18/20
8,2,2,3/19/20
...

where the first column is the total cumulative confirmed cases of that date, the second column is the total cumulative recovered cases as of that day, the third column is the total cumulative confirmed deaths as of that day, and finally the date

I used Python 3.8.2 for this. Main requirements are sklearn, pandas, statsmodels, and matplotlib

Settings

Most Settings are directly in the *.py file, at the top

# How many days in the future to forecast
forecast_days = 7

# Show how well the models fit on the actual/existing data.
# If false, it only shows the prediction/future portions
show_fit_on_actual = False

# Included are several models, some of which probably suck.
# The exponential one usually throws off the scale of everything else,
# so you can turn it off here
show_that_one_giant_red_line = True

# Some models definitely will suck, such as linear regression, and SVR sigmoid
# you can turn them off here
ignore_shitty_ones = True

# The name of the file under the local 'data' dir, without the extension
file_to_load = "example"

There is also an example-settings.py file. Rename to settings.py to use

Example output

Covid19Example

SIR Model

Overview

Based mostly on work from https://github.com/Lewuathe/COVID19-SIR and https://www.kaggle.com/saga21/covid-global-forecast-sir-model-ml-regressions/notebook

see https://en.wikipedia.org/wiki/Compartmental_models_in_epidemiology#The_SIR_model

The SIR Model: "The model consists of three compartments: S for the number of susceptible, I for the number of infectious, and R for the number recovered (or immune) individuals. This model is reasonably predictive for infectious diseases which are transmitted from human to human"

An example of what it looks like: SIRExample

Fitting the SIR model to data SIRFitExample

Predicting w/ SIR model Fitting the SIR model to data SIRPrediction

covid19-predict's People

Contributors

advanced4 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.