了解 Prophet 中的“performance_metrics()”,它是如何工作的以及它的意义

问题描述 投票:0回答:0

我正在使用 Prophet 进行时间序列预测。为了衡量我的模型的性能,我一直在通过将交叉验证数据帧传递给自制函数来计算 MAE 和 MAPE 等错误。例如:

def MAPE(y_true, y_pred):
    y_true = np.array(y_true)
    y_pred = np.array(y_pred)
    return np.mean(np.abs((y_true - y_pred)/y_true))*100

运行模型并生成交叉验证 df 后:

MAPE(cv.y, cv.yhat)

然而,最近我发现了Prophet 中的“性能指标”功能。 将我的简历数据框传递给它后,我得到了这个数据框:

m = Prophet()
m.fit(temp)
future_temp = m.make_future_dataframe(periods=12, freq = 'M')
forecast_temp = m.predict(future_temp)
forecast_temp['key'] = 9253010010
cv = cross_validation(m,initial = '730 days', period = '31 days', horizon = '365 days')
#forecast_temp[['key', 'ds', 'yhat', 'yhat_lower', 'yhat_upper']]
#f = m.plot(forecast_temp)

ax = temp.plot(x='ds',y='y')
forecast_temp.plot(x='ds',y='yhat', ax=ax)

(https://i.stack.imgur.com/Du5w5.png)

(https://i.stack.imgur.com/4A8HF.png)

我在此数据框中得到的错误值远不及我到目前为止手动计算的错误值,我无法解释这一点。我的一些问题是: 它是如何计算不同视野的误差值的? 为什么它从 32 天的地平线开始计算误差?

我对此很陌生,对此功能的任何深入解释以及与我的手动方法的比较都会有所帮助。

谢谢!

我尝试了手动方法来计算错误,但它给出的结果与“性能指标”返回的结果有很大不同。我无法解释它返回的数据框。

time-series forecasting facebook-prophet
© www.soinside.com 2019 - 2024. All rights reserved.