简体   繁体   中英

How to compute RMSE between two GPS coordinates (latitude and longitude) in Python

Good morning guys,

I would like to calculate the RMSE error between two gps coordinates (latitude and longitude).

Do you know if and how I can apply it to a known coordinate pair?

Using numpy you can do the following for longitude, and same for the latitude.

import numpy as np
longitude = [1,2,3,4,5]
longitude_pred = [1.6,2.5,2.9,3,4.1]
 
MSE_longitude = np.square(np.subtract(longitude, longitude_pred)).mean() 
 
RMSE_longitude = np.sqrt(MSE)

If your coordinates is matrix of shape [2, n]:

import numpy as np
long_lat = [[1,2,3,4,5], [1,2,3,4,5]]
long_lat_pred = [[1.6,2.5,2.9,3,4.1], [1.6,2.5,2.9,3,4.1]]
 
MSE_long_lat = np.square(np.subtract(long_lat, long_lat_pred)).mean(axis=1)
 
RMSE_long_lat = np.sqrt(MSE)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM