Linear regression
Linear regression has been around since the 1800s but is still used today. It is an easy-to-use and -interpret method that generally works for many datasets as long as we have relationships between our features and target that are somewhat linear and a few other assumptions are met.
With linear regression, we predict continuous values based on our features, and our results may look something like this:
Figure 13.1: An example of a linear regression fit to data
Here, we have a scatter plot of square feet of the first floor of a house on the x-axis and the sale price on the y-axis. We can see a generally linear relationship holds, with higher prices corresponding to bigger square footage. The line shows a linear fit to the data.
To fit a simple 1-D linear model as shown above, we use the equation:
Where m is the coefficient for our input feature and b is the value at which the line intersects the y-axis (the y-intercept). We can generalize...