Issue
I would like to use RMSE to compare more than two data samples (10 to be exact). I found this function which is used to compare two data samples the actual and predicted samples of a model. I am wondering if I can use the same or similar function to compute RMSE of the 10 data samples in one go.
RMSE = sklearn.metrics.mean_squared_error(datasample1, datasample2, squared=False)
Solution
If you're looking for the average RMSE across all pairwise sample comparisons, then you can use the following:
import numpy as np
from sklearn.metrics import mean_squared_error as mse
datasamples = [datasample1, ..., datasample10]
# Function to calculate pairwise RMSEs
pairwise_RMSE = lambda x : [mse(x[i], x[j], squared=False) for i in range(j, len(x)) for j in range(i,len(x))]
RMSEs = pairwise_RMSE(datasamples) # RMSE for each pairwise comparison
mean_RMSE = np.mean(RMSEs) # Mean of all pairwise comparisons
Answered By - mdgrogan
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.