【问题标题】:Why Prophet returns negative prediction whan inputs are all positive?为什么 Prophet 在输入全部为正时返回负预测?
【发布时间】:2020-05-08 14:19:31
【问题描述】:

我正在尝试使用 Facebook Prophet 进行预测,输入都是正数,但预测返回负数。我有点困惑,我读了这个quick start,如果输入都是正数,那么预测可能都是正数,并且预测的形状与输入相似,例如,如果输入为 0.86,那么输出将为 0.81 .为什么会这样?如何解决?

covid_pr = covid[['date','acc_confirmed']].copy()
covid_pr.rename(columns = {'date':'ds', 'acc_confirmed':'y'},inplace= True)

prt = Prophet()
prt.fit(covid_pr)

future_prt = prt.make_future_dataframe(30)
forecast = prt.predict(future_prt)

我的输入数据

           ds     y
0  2020-03-02     2
1  2020-03-03     2
2  2020-03-04     2
3  2020-03-05     2
4  2020-03-06     4
5  2020-03-07     4
6  2020-03-08     6
7  2020-03-09    19
8  2020-03-10    27
9  2020-03-11    34
10 2020-03-12    34
etc until thousands

fbprophet 的预测

     yhat   yhat_lower   yhat_upper
0   -261.572541  -499.409024    -4.741004
1   -208.490561  -446.503629    41.371788
2   -255.114682  -500.580393    -7.825269
3   -208.963597  -481.238870    33.707433
4   -146.566250  -394.337188    96.726382
5    -92.445918  -354.914790   150.409867
6    -38.341696  -293.639411   204.964963
7     83.483534  -158.412231   332.263619
8    136.565514   -95.174934   370.980615
9     89.941393  -153.219255   349.129866
10   136.097121   -95.508485   404.666524
etc until thousands

【问题讨论】:

  • 你能画出数据和预测吗?如果存在负面趋势,则预测很可能会遵循该趋势(对于任何好的模型),无论考虑到建模域这是否有意义。我在这里看不到任何代码问题,本身,所以最好在Cross Validated 询问。
  • 从 fbprohphet 组件来看,它表明存在负的每周季节性

标签: python time-series forecast facebook-prophet


【解决方案1】:

facebook 先知饱和-最小页面是您想要查看的内容。您甚至可以为每一行指定一个限制。

https://facebook.github.io/prophet/docs/saturating_forecasts.html#saturating-minimum

为了有界,您必须使用增长逻辑。 假设您未来的数据框称为未来,您可以指定 floor 列,如下所示:

future['floor'] = 0
m = Prophet(growth='logistic')
m.fit(df)
result = m.predict(future)

【讨论】:

  • 哦,好吧,这是我第一次使用 fbprophet,我已经阅读了您提供的链接以及 very similar link。但我不明白为什么 saturating-minimum 会是我的解决方案。你能帮我解释一下吗?
猜你喜欢
  • 2019-04-28
  • 2018-03-05
  • 2017-12-08
  • 1970-01-01
  • 2012-08-12
  • 1970-01-01
  • 1970-01-01
  • 2018-01-29
  • 2020-04-01
相关资源
最近更新 更多