15.7 Linear regression
Linear regression is a technique we use to fit a hyperplane to a training set of independent variables and one dependent variable.
A common use is determining the “best” line that best approximates the points in a 2-dimensional scatter plot. Here, the x coordinate is the independent variable, and the y coordinate is the dependent variable. This is simple linear regression.
If we have more than one independent variable, we are performing multiple linear regression. In this section, we look at a simple case and the ordinary least squares algorithm.
Given a new independent observation, x, the line’s equation allows us to compute an estimated value for its dependent y. Let xmin and xmax be the minimum and maximum values of x in the training set. If
xmin ≤ x ≤ xmax
then the prediction of y is interpolation. Otherwise, the prediction...