Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download
117 views
ubuntu2004
Kernel: Python 3 (system-wide)

I did

pip install prophet # takes about 30s to compile

in a terminal first before using this notebook. This of course requires an upgraded project so you can access the internet.

I then followed an example at https://facebook.github.io/prophet/docs/quick_start.html

!wget https://raw.githubusercontent.com/facebook/prophet/main/examples/example_wp_log_peyton_manning.csv
--2022-05-07 02:07:10-- https://raw.githubusercontent.com/facebook/prophet/main/examples/example_wp_log_peyton_manning.csv Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 185.199.110.133, 185.199.109.133, 185.199.111.133, ... Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|185.199.110.133|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 86845 (85K) [text/plain] Saving to: ‘example_wp_log_peyton_manning.csv’ example_wp_log_peyt 100%[===================>] 84.81K --.-KB/s in 0.01s 2022-05-07 02:07:10 (6.20 MB/s) - ‘example_wp_log_peyton_manning.csv’ saved [86845/86845]
import pandas as pd from prophet import Prophet
df = pd.read_csv('./example_wp_log_peyton_manning.csv') df.head()
m = Prophet() m.fit(df)
INFO:prophet:Disabling daily seasonality. Run prophet with daily_seasonality=True to override this.
Initial log joint probability = -19.4685 Iter log prob ||dx|| ||grad|| alpha alpha0 # evals Notes 99 7975.23 0.00333027 229.371 1 1 129 Iter log prob ||dx|| ||grad|| alpha alpha0 # evals Notes 199 7993.56 0.000129511 136.478 0.02731 1 250 Iter log prob ||dx|| ||grad|| alpha alpha0 # evals Notes 299 7997.17 0.000734911 157.438 0.8599 0.8599 369 Iter log prob ||dx|| ||grad|| alpha alpha0 # evals Notes 325 7998.51 8.30685e-05 244.937 2.117e-07 0.001 442 LS failed, Hessian reset 399 8000.57 8.73339e-05 65.5818 1 1 533 Iter log prob ||dx|| ||grad|| alpha alpha0 # evals Notes 499 8002.44 0.000319089 237.64 0.9297 0.9297 6
<prophet.forecaster.Prophet at 0x7fab2f2c0430>
57 Iter log prob ||dx|| ||grad|| alpha alpha0 # evals Notes 599 8003.78 0.0047489 442.915 0.2226 0.2226 784 Iter log prob ||dx|| ||grad|| alpha alpha0 # evals Notes 603 8003.81 0.000799967 414.813 1.139e-05 0.001 820 LS failed, Hessian reset 699 8004.62 5.85863e-05 178.881 0.4416 0.4416 939 Iter log prob ||dx|| ||grad|| alpha alpha0 # evals Notes 748 8004.75 4.62273e-05 116.152 7.253e-07 0.001 1055 LS failed, Hessian reset 793 8004.8 6.11982e-07 60.2887 0.4229 0.4229 1115 Optimization terminated normally: Convergence detected: relative gradient magnitude is below tolerance
future = m.make_future_dataframe(periods=365) future.tail()