computing RMSE for training data