In [19]:
from fbprophet import Prophet
%config InlineBackend.figure_format = 'retina'
In [6]:
import pandas as pd
In [7]:
df = pd.read_csv("./data/example_wp_log_peyton_manning.csv")
In [8]:
df.head(3)
Out[8]:
In [9]:
m = Prophet(daily_seasonality=True)
In [29]:
Prophet?
In [11]:
m.fit(df)
Out[11]:
In [12]:
future = m.make_future_dataframe(periods=365)
future.tail()
Out[12]:
In [13]:
forecast = m.predict(future)
In [32]:
forecast.columns
Out[32]:
In [14]:
forecast.tail()
Out[14]:
In [15]:
forecast[['ds', 'yhat', 'yhat_lower', 'yhat_upper']].tail()
Out[15]:
In [21]:
fig1 = m.plot(forecast)
In [20]:
fig2 = m.plot_components(forecast)
In [22]:
df['cap'] = 8.5
In [23]:
m = Prophet(growth='logistic')
m.fit(df)
Out[23]:
In [25]:
future = m.make_future_dataframe(periods=1826)
future['cap'] = 8.5
fcst = m.predict(future)
fig = m.plot(fcst)
In [27]:
df['y'] = 10 - df['y']
df['cap'] = 6
df['floor'] = 1.5
future['cap'] = 6
future['floor'] = 1.5
m = Prophet(growth='logistic', daily_seasonality=True)
m.fit(df)
fcst = m.predict(future)
fig = m.plot(fcst)
In [ ]: