Understanding linear regression

The easiest regression model is called linear regression. The idea behind linear regression is to describe a target variable (such as Boston house pricing—recall the various datasets we studied in Chapter 1, A Taste of Machine Learning) with a linear combination of features.

To keep things simple, let's just focus on two features. Let's say we want to predict tomorrow's stock prices using two features: today's stock price and yesterday's stock price. We will denote today's stock price as the first feature, f1, and yesterday's stock price as f2. Then, the goal of linear regression would be to learn two weight coefficients, w1 and w2, so that we can predict tomorrow's stock price as follows:

Here,  is the 

Get Machine Learning for OpenCV 4 - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.