我一直在尝试 facebook 的预测包,名为先知。即使我设置了代码、示例数据和包,结果似乎也失败了。这是代码和数据。
import pandas as pd
from fbprophet import Prophet
# Python
df = pd.read_csv('./test.csv')
df.head()
m = Prophet(yearly_seasonality=True, daily_seasonality=True)
m.fit(df)
future = m.make_future_dataframe(periods=365)
future.tail()
forecast = m.predict(future)
forecast.head()
forecast[['ds', 'yhat', 'yhat_lower', 'yhat_upper']].tail()
数据(test.csv)
,ds,y
0,2021-12-10,1
1,2021-12-11,0
2,2021-12-12,0
3,2021-12-13,1
4,2021-12-14,1
5,2021-12-15,2
6,2021-12-16,5
7,2021-12-17,0
8,2021-12-18,0
9,2021-12-19,0
10,2021-12-20,1
当我运行时,结果是这样的。
$ python3 predict.py
INFO:fbprophet:Disabling weekly seasonality. Run prophet with weekly_seasonality=True to override this.
INFO:fbprophet:n_changepoints greater than number of observations. Using 7.
Initial log joint probability = -91.9162
Iteration 1. Log joint probability = -0.202158. Improved by 91.7141.
Iteration 2. Log joint probability = 4.48295. Improved by 4.68511.
Iteration 3. Log joint probability = 4.69649. Improved by 0.213543.
Iteration 4. Log joint probability = 4.77003. Improved by 0.0735347.
Iteration 5. Log joint probability = 4.81532. Improved by 0.0452924.
Iteration 6. Log joint probability = 4.92782. Improved by 0.1125.
Iteration 7. Log joint probability = 5.00881. Improved by 0.0809877.
Iteration 8. Log joint probability = 8.77698. Improved by 3.76817.
Iteration 9. Log joint probability = 8.85044. Improved by 0.0734641.
Iteration 10. Log joint probability = 8.9742. Improved by 0.12376.
Iteration 11. Log joint probability = 9.02056. Improved by 0.0463593.
似乎失败了,不是吗?你能告诉我缺少什么吗?