Giter VIP home page Giter VIP logo

corona-virus-prediction's Introduction

Corona-Virus-Prediction

Time series analysis with Corona Virus Daily Data and ARIMA models

ARIMA(Autoregressive integrated moving average) 란?

In statistics and econometrics, and in particular in time series analysis, an autoregressive integrated moving average (ARIMA) model is a generalization of an autoregressive moving average (ARMA) model. Both of these models are fitted to time series data either to better understand the data or to predict future points in the series (forecasting). WIKIPEDIA

Example

  1. Use getData.py to bring ./data/data.csv Corona virus daily status Dataset

  2. Show a Data Graph

data = getData.read_csv('list')

def ShowGraph(data):
  df = pd.DataFrame(data, columns = ['date' , 'value'])
  df.date = pd.to_datetime(df.date)
  df.value = pd.to_numeric(df['value'])
  df = df.set_index('date')
  g = df['value'].plot(title="Corona-Virus Daily data")
  plt = g.get_figure()
  ...

  1. ACF & PAF Calculation and Show a graphs
def Calc_ACF_PAF():
  ...
  plot_acf(data)
  plot_pacf(data)
  ...

Left : ACF / Right : PACF

  1. Forecast using ARIMA models
def ARIMA():
  ...
  order = (0,1,1)
  model = statsmodels.tsa.arima_model.ARIMA(series, order, freq='D')
  model_fit = model.fit(trend='c',full_output=True, disp=10)
  ...
  1. Show a graph
def ARIMA():
  ...
  plt = model_fit.plot_predict()
  Number_to_predict = 3
  fore = model_fit.forecast(steps=Number_to_predict)
  ...

Orange Line : Origin / Blue Line : Forecast

  1. Result
for x in fore[0]:
        p_time = time + timedelta(days=Number_to_predict)
        p_time = p_time.strftime('%Y-%m-%d')
        print("{0} : {1}".format(p_time, x))
        Number_to_predict += 1
# Output
2020-03-09 : 6057.29830482379
2020-03-10 : 6196.215619909736
2020-03-11 : 6335.132934995682

Differences between actual data and forecast results

날짜 Predict Actuality Difference
2020-03-09 6057 7382 1325
2020-03-10 6196 7513 1317
2020-03-11 6335 7755 1420

Execution / Test Environment

  • Window 10
  • Python 3.6

corona-virus-prediction's People

Contributors

xenia101 avatar

Stargazers

 avatar

Watchers

 avatar  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.