Regression model evaluation using Spark 2.0
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 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 metrics provided by 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 the book.
How to do it...
- Start a new project in IntelliJ or in an IDE of your choice. Make sure that the necessary JAR files are included.
- Set up the package location where the program will reside:
package spark.ml.cookbook.chapter4
- Import the necessary packages for SparkContext to get access to the cluster:
import org.apache.spark...