Google Colab返回的先知-错误:KeyError:“ metric_file”

时间:2019-10-30 11:42:58

标签: python google-colaboratory facebook-prophet

今天,我开始使用Facebook先知的colab脚本出现问题。 我尝试在基本脚本上重现错误。
问题出在线上:

m.fit(df)

在这里您可以找到错误:

KeyError                                  Traceback (most recent call last)<br>
KeyError: 'metric_file'<br>
and the session crashed.<br>
<br>

在这里您可以找到完整的代码:

Python

import pandas as pd

from fbprophet import Prophet

df=pd.read_csv('https://raw.githubusercontent.com/facebook/prophet/master/examples/example_wp_log_peyton_manning.csv')
df.head()

m = Prophet()

m.fit(df)

forecast = m.predict(future)

forecast[['ds', 'yhat', 'yhat_lower', 'yhat_upper']].tail()

fig1 = m.plot(forecast)

谢谢。

1 个答案:

答案 0 :(得分:0)

现在固定购买google。

我的脚本中有一个错误,我忘了插入两行。在这里您可以找到有效的代码:

“”“ 先知简介:https://facebook.github.io/prophet/docs/quick_start.html#python-api “”“

Python

将熊猫作为pd导入 从fbprophet导入先知

Python

df = pd.read_csv('https://raw.githubusercontent.com/facebook/prophet/master/examples/example_wp_log_peyton_manning.csv')

df.head()

m =先知()

m.fit(df)

** future = m.make_future_dataframe(periods = 365)

future.tail()**

预测= m.predict(未来)

forecast [['ds','yhat','yhat_lower','yhat_upper']]。tail()

fig1 = m.plot(预测)