July 2017
Beginner to intermediate
715 pages
17h 3m
English
Mean Squared Error (MSE) is the sum of squared differences between the actual and predicted values. It is quite easy to compute it in Java:
double[] actual, predicted; int n = actual.length; double sum = 0.0; for (int i = 0; i < n; i++) { diff = actual[i] - predicted[i]; sum = sum + diff * diff; } double mse = sum / n;
Typically, the value of MSE is hard to interpret, which is why we often take a square root of MSE; this is called Root Mean Squared Error (RMSE). It is easier to interpret because it is in the same units as the target variable.
double rmse = Math.sqrt(mse);