Linear regression solves the least squares equation to discover the parameters vector theta. In this section, we will walk through the source code for a linear regression class in the packtml Python library and then cover a brief graphical example in the examples directory.
Before we look at the code, we will be introduced to the interface that backs all of the estimators in the book. It is called BaseSimpleEstimator, which is an abstract class. It's going to enforce only one method, which is predict. Different subclass layers are going to enforce other methods for different model families. But this layer backs all the models that we will build, as everything that we are putting together is supervised, so it's all going to need to be able to predict. You will notice that the signature is prescribed in the dock string. Every...