改写代码:def RMSE_MAPE(ydata,y_hatdata,indexlist): y = ydata.loc[indexlist].values.T y_hat = y_hatdata.loc[indexlist].values.T x1 = np.power(y - y_hat, 2).mean() x2 = np.abs((y - y_hat) / y).mean() RMSE = np.sqrt(x1) MAPE = x2*100 #输出结果单位为% print(f'RMSE:{RMSE} MAPE:{MAPE}') return RMSE, MAPE
时间: 2023-06-09 17:07:17 浏览: 181
RMSE_SPEC.m.zip_RMSE_RMSE.m文件_statistic _wave
修改代码如下:
def RMSE_MAPE(ydata, y_hatdata, indexlist):
y = ydata.loc[indexlist].values.T
y_hat = y_hatdata.loc[indexlist].values.T
diff = y - y_hat
x1 = np.mean(diff**2)
x2 = np.mean(np.abs(diff/y))
RMSE = np.sqrt(x1)
MAPE = x2 * 100
阅读全文