MAPE 在 Python 中是 inf 吗?

问题描述

我的 ARIMA 模型结果如下:

enter image description here

我尝试使用以下代码计算 MAPE 统计数据:

def mape(actual,pred): 
    actual,pred = np.array(actual),np.array(pred)
    return np.mean(np.abs((actual - pred) / actual)) * 100

尽管如此,我的 MAPE 是通过使用上面的代码来确定的:

enter image description here

我计算 MAPE 的代码有什么错误吗?我能改变什么? 我可以补充一点,我在预测中没有 0。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)