from fbprophet.diagnostics import performance_metrics
df_p = performance_metrics(df_cv)
df_p.head()

 

  horizon mse rmse mae mape coverage
3297 37 days 0.481970 0.694241 0.502930 0.058371 0.673367
35 37 days 0.480991 0.693535 0.502007 0.058262 0.675879
2207 37 days 0.480936 0.693496 0.501928 0.058257 0.675879
2934 37 days 0.481455 0.693870 0.502999 0.058393 0.675879
393 37 days 0.483990 0.695694 0.503418 0.058494 0.675879

 

mape平均绝对百分误差

定义
MAPE 平均绝对百分误差-编程知识网

def evalmape(preds, dtrain):
    gaps = dtrain.get_label()
    err = abs(gaps-preds)/gaps
    err[(gaps==0)] = 0
    err = np.mean(err)*100
    return 'error',err