Facebook Prophet 多元预测 "Found NaN in column"

Facebook Prophet Multivariate Forecasting "Found NaN in column"

我有一个多元五年数据集,除了 y 之外还有其他五个特征。我有一个训练测试集,训练集是前 4 年。我想让它预测第 5 年,这样我就可以将结果与第 5 年的实际数据进行比较。

我用 make_future_dataframe(periods=365) 创建了 future 数据框。我 pandas.concat 未来并训练 DF(因为 pandas.merge 切断了第 5 年的空白)future_regressors = pandas.concat([future, train[['f1', 'f2', 'f3', 'f4', 'f5']]], axis=1)。然而,Prophet 希望 5 个回归器在第 5 年有值(它通过抱怨第 5 年开始的 NaN 来表达),但数据确实存在于训练集中。

解决此问题的最佳方法是什么?

this SO post 上找到了答案,具体来说:

Note that the additional variables should have values for your future (test) data. If you don't have them, you could start by predicting add1 and add2 with univariate timeseries, and then predict y with add_regressor and the predicted add1 and add2 as future values of the additional variables.