Introducing linear regression
Before we delve into solving the main problem of this chapter, we need to provide the necessary theoretical framework. This section presents an ML technique purposely chosen to unfold the discussion and facilitate understanding of the methods that follow.
Let’s consider the three plots in Figure 4.11 that show the relationship between two variables: x and y. In this example, the opaque and transparent points correspond in one of two independent datasets:
Figure 4.11 – Variables with deterministic (A), statistical (B), and random relationship (C)
In Figure 4.11 (A), the points of both datasets reside on their line, which defines a clear deterministic relationship between the two variables. As x changes its value, we can precisely calculate the value of y using one of the line equations. In the middle plot, we cannot predict the exact value of y, but we can obtain a good approximation based again on the line equations...