Root mean-squared error - L2 Loss

Root mean-squared error (RMSE) is a function for assessing Regression predictions. Sometimes called L2 Error because it takes the L2 Norm of the error vector.


  1. Calculate error vector as labels - predictions
  2. Square the errors to make values positive.
  3. Take the mean of all values.
  4. Take the square root of the mean.

1ni=1Nlabelspredictions\sqrt{\frac{1}{n} \sum\limits_{i=1}^{N} |{labels}-{predictions}|}

An alternative to Mean Absolute Difference - L1 Loss, where the key difference is the square operation instead of the absolute value. Because the square operations penalises very wrong predictions, it is often preferred. However, some also say it can be sensitive to outliers. In my experience, it's usually worth trying both (or some combination).

Sometimes you choose not to perform the square root operation when in a loss function. In that case, the operation is called a squared L2 Norm and expressed e22\| e\|^{2}_{2}