In this recipe, we explore how to evaluate a regression model (a regression decision tree in this example). Spark provides the RegressionMetrics facility which has basic statistical facilities such as Mean Squared Error (MSE), R-Squared, and so on, right out of the box.
The objective in this recipe is to understand the evaluation metrics provided by Spark out of the box. It is best to concentrate on step 8 since we cover regression in more detail in Chapter 5, Practical Machine Learning with Regression and Classification in Spark 2.0 - Part I and Chapter 6, Practical Machine Learning with Regression and Classification in Spark 2.0 - Part II and throughout the book.