We saw in the previous lesson we already have a very good model for predicting the
petal length of a flower based on its petal width. But let's see if we can improve
the model. There are a few ways we can do this. Let's begin by adding the remaining
variables to the linear regression equation. To represent these additional variables
in the equation let's adjust our notation. Let
And in matrix form we collect the variables into a matrix
In the above code editor we wrapped the estimated coefficients in a
np.round to round the coefficients to two decimal places
just to make the output easier to read. Next, let's get the predicted
values using these estimated coefficients so we can check its performance
in terms of the mean squared error.
Awesome, the mean square error is even smaller than before! We improved the model by reducing the MSE from 0.86 to 0.1. That will be the most we improve the model for now, next we will apply linear regression to a different dataset to get some more practice with it in a different context.