LSTM, GRU, MNN模型经纬度误差评估
import pandas as pd import numpy as np import matplotlib.pyplot as plt
y_hat = pd.read_csv('y_hat.csv') # len = 93 predict_Y = pd.read_csv('predict_Y.csv') # len = 92 original = pd.read_csv('original.csv') # len = 100 y_pred = pd.read_csv('y_pred_mnn.csv') # len = 100
plt.figure(figsize=(10, 10)) plt.xlabel('Longitude Error (degree)') plt.ylabel('Latitude Error (degree)')
LSTM
a_lat_LSTM = [] b_lon_LSTM = [] for i in range(len(y_hat)): long = original.iloc[i + 7, 1] - y_hat.iloc[i, 1] lat = original.iloc[i+7, 0] - y_hat.iloc[i, 0] a_lat_LSTM.append(long) b_lon_LSTM.append(lat)
GRU
a_lat_GRU = [] b_lon_GRU = [] for i in range(len(predict_Y)): long = original.iloc[i+8, 1] - predict_Y.iloc[i, 1] lat = original.iloc[i+8, 0] - predict_Y.iloc[i, 0] a_lat_GRU.append(long) b_lon_GRU.append(lat)
MNN
a_lat_MNN = [] b_lon_MNN = [] for i in range(len(y_pred)): long = original.iloc[i, 1] - y_pred.iloc[i, 2] lat = original.iloc[i, 0] - y_pred.iloc[i, 1] a_lat_MNN.append(long) b_lon_MNN.append(lat)
计算LSTM,MNN,GRU经纬度的MSE,MAE,RMSE
LSTM
MSE_lat_LSTM = np.square(np.array(a_lat_LSTM)).mean() MAE_lat_LSTM = np.abs(np.array(a_lat_LSTM)).mean() RMSE_lat_LSTM = np.sqrt(MSE_lat_LSTM)
MSE_lon_LSTM = np.square(np.array(b_lon_LSTM)).mean() MAE_lon_LSTM = np.abs(np.array(b_lon_LSTM)).mean() RMSE_lon_LSTM = np.sqrt(MSE_lon_LSTM)
GRU
MSE_lat_GRU = np.square(np.array(a_lat_GRU)).mean() MAE_lat_GRU = np.abs(np.array(a_lat_GRU)).mean() RMSE_lat_GRU = np.sqrt(MSE_lat_GRU)
MSE_lon_GRU = np.square(np.array(b_lon_GRU)).mean() MAE_lon_GRU = np.abs(np.array(b_lon_GRU)).mean() RMSE_lon_GRU = np.sqrt(MSE_lon_GRU)
MNN
MSE_lat_MNN = np.square(np.array(a_lat_MNN)).mean() MAE_lat_MNN = np.abs(np.array(a_lat_MNN)).mean() RMSE_lat_MNN = np.sqrt(MSE_lat_MNN)
MSE_lon_MNN = np.square(np.array(b_lon_MNN)).mean() MAE_lon_MNN = np.abs(np.array(b_lon_MNN)).mean() RMSE_lon_MNN = np.sqrt(MSE_lon_MNN)
print('LSTM:') print('MSE of Latitude Error:', MSE_lat_LSTM) print('MAE of Latitude Error:', MAE_lat_LSTM) print('RMSE of Latitude Error:', RMSE_lat_LSTM) print('MSE of Longitude Error:', MSE_lon_LSTM) print('MAE of Longitude Error:', MAE_lon_LSTM) print('RMSE of Longitude Error:', RMSE_lon_LSTM)
print('GRU:') print('MSE of Latitude Error:', MSE_lat_GRU) print('MAE of Latitude Error:', MAE_lat_GRU) print('RMSE of Latitude Error:', RMSE_lat_GRU) print('MSE of Longitude Error:', MSE_lon_GRU) print('MAE of Longitude Error:', MAE_lon_GRU) print('RMSE of Longitude Error:', RMSE_lon_GRU)
print('MNN:') print('MSE of Latitude Error:', MSE_lat_MNN) print('MAE of Latitude Error:', MAE_lat_MNN) print('RMSE of Latitude Error:', RMSE_lat_MNN) print('MSE of Longitude Error:', MSE_lon_MNN) print('MAE of Longitude Error:', MAE_lon_MNN) print('RMSE of Longitude Error:', RMSE_lon_MNN)
原文地址: https://www.cveoy.top/t/topic/l6CX 著作权归作者所有。请勿转载和采集!