CoCalc Public Filesscratch / fbprophet-test.ipynb
Authors: Harald Schilly, ℏal Snyder
Views : 62
Compute Environment: Ubuntu 18.04 (Deprecated)

# Prophet on CoCalc

Forecasting at scale!

In [17]:
import pandas as pd from fbprophet import Prophet
In [2]:
fn = "example_wp_log_peyton_manning.csv"
In [16]:
! wget -q -O \$fn https://raw.githubusercontent.com/facebook/prophet/master/examples/example_wp_log_peyton_manning.csv
In [3]:
ds y
0 2007-12-10 9.590761
1 2007-12-11 8.519590
2 2007-12-12 8.183677
3 2007-12-13 8.072467
4 2007-12-14 7.893572
In [10]:
m = Prophet() m.fit(df)
INFO:fbprophet:Disabling daily seasonality. Run prophet with daily_seasonality=True to override this.
<fbprophet.forecaster.Prophet at 0x7f1715940048>
In [11]:
future = m.make_future_dataframe(periods=365) future.tail()
ds
3265 2017-01-15
3266 2017-01-16
3267 2017-01-17
3268 2017-01-18
3269 2017-01-19
In [12]:
forecast = m.predict(future) forecast[['ds', 'yhat', 'yhat_lower', 'yhat_upper']].tail()
ds yhat yhat_lower yhat_upper
3265 2017-01-15 8.199274 7.437537 8.908045
3266 2017-01-16 8.524244 7.845854 9.226016
3267 2017-01-17 8.311615 7.573729 9.070347
3268 2017-01-18 8.144232 7.485096 8.875287
3269 2017-01-19 8.156091 7.437957 8.821215
In [13]:
fig1 = m.plot(forecast)
In [14]:
fig2 = m.plot_components(forecast)
In [ ]:
In [ ]: