In this recipe, we present an alternative to Gradient Descent (GD) and LBFGS by using Normal Equations to solve linear regression. In the case of normal equations, you are setting up your regression as a matrix of features and vector of labels (dependent variables) while trying to solve it by using matrix such as inverse, transpose, and so on.
The emphasis here is to highlight Spark's facility for using Equations to solve Linear Regression and not the details of the model or generated coefficients.
- We use the same housing dataset which we extensively covered 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, which relate various attributes (for example number of rooms, and so on) to the price of the house.
The data is available as housing8.csv
under the...