fromfbprophet.diagnosticsimportperformance_metricsdf_p =performance_metrics(df_cv)df_p.head()

horizonmsermsemaemapecoverage
329737 days0.4819700.6942410.5029300.0583710.673367
3537 days0.4809910.6935350.5020070.0582620.675879
220737 days0.4809360.6934960.5019280.0582570.675879
293437 days0.4814550.6938700.5029990.0583930.675879
39337 days0.4839900.6956940.5034180.0584940.675879

mape平均绝对百分误差

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