Prophetを使用したサンプルとして、厚生労働省のオープンデータを使用して、入院治療等を要する人数を予測してみました。
%matplotlib inline
import urllib
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from fbprophet import Prophet
cases_total_req = urllib.request.urlopen('https://www.mhlw.go.jp/content/cases_total.csv')
cases_total_df = pd.read_csv(cases_total_req)
cases_total_df['ds'] = pd.to_datetime(cases_total_df['日付']).dt.date
cases_total_df['y'] = cases_total_df['入院治療を要する者']
cases_total_df['y'].plot()
<matplotlib.axes._subplots.AxesSubplot at 0x1648a3d9c88>
model = Prophet()
model.fit(cases_total_df)
INFO:fbprophet:Disabling yearly seasonality. Run prophet with yearly_seasonality=True to override this.
INFO:fbprophet:Disabling daily seasonality. Run prophet with daily_seasonality=True to override this.
<fbprophet.forecaster.Prophet at 0x1648a8297c8>
future = model.make_future_dataframe(periods=365)
forecast = model.predict(future)
model.plot(forecast)