In the previous section, we dealt with linear regression with one variable. Now we will learn an extended version of linear regression, where we will use multiple input variables to predict the output.
Multiple Linear Regression
If you recall the formula for the line of best fit in linear regression, it was defined as , where is the slope of the line, is the y intercept of the line, x is the feature value, and y is the calculated label value.
In multiple regression, we have multiple features and one label. If we have three features, x1, x2, and x3, our model changes to .
In NumPy array format, we can write this equation as follows:
y = np.dot(np.array([a1, a2, a3]), np.array([x1, x2, x3])) + b
For convenience, it makes sense to define the whole equation in a vector multiplication format. The coefficient of is going to be 1
:
y = np.dot(np.array([b, a1, a2, a3]) * np.array([1, x1, x2, x3]))
Multiple linear regression...