Skip to Content
Java: Data Science Made Easy
book

Java: Data Science Made Easy

by Richard M. Reese, Jennifer L. Reese, Alexey Grigorev
July 2017
Beginner to intermediate
715 pages
17h 3m
English
Packt Publishing
Content preview from Java: Data Science Made Easy

MSE

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);
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Java Data Science Cookbook

Java Data Science Cookbook

Rushdi Shams
Java for Data Science

Java for Data Science

Walter Molina, Richard M. Reese, Shilpi Saxena, Jennifer L. Reese

Publisher Resources

ISBN: 9781788475655Supplemental Content