【问题标题】:Prophet on google colab return - Error: KeyError: 'metric_file'谷歌 colab 上的先知返回 - 错误:KeyError:'metric_file'
【发布时间】:2020-02-25 16:59:35
【问题描述】:

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

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)

谢谢,F.

【问题讨论】:

    标签: python google-colaboratory facebook-prophet


    【解决方案1】:

    100% 保证解决方案!

    安装熊猫: pip install pandas==1.0.4

    安装pystan: conda install -c conda-forge pystan==2.19.1.1

    安装 fbprophet: conda install -c conda-forge fbprophet conda install -c conda-forge/label/cf201901 fbprophet

    按照步骤并运行您的代码,它将解决问题。

    【讨论】:

      【解决方案2】:

      尝试下面的代码来解决问题。

      conda install pystan==2.17.1.0
      conda install -c conda-forge fbprophet==0.6.0
      

      【讨论】:

        【解决方案3】:

        现在是固定购买谷歌。

        我的脚本有错误,我忘了插入两行。在这里你可以找到工作代码:

        """ 先知介绍来自:https://facebook.github.io/prophet/docs/quick_start.html#python-api """

        Python

        将熊猫导入为 pd 从 fbprophet 导入 Prophet

        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(未来)

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

        fig1 = m.plot(预测)

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2015-04-05
          • 1970-01-01
          • 1970-01-01
          • 2022-10-03
          • 1970-01-01
          相关资源
          最近更新 更多