Linear regression module1 - rafi966/Machine-Learning GitHub Wiki
Linear regression is a statistical technique used to find the relationship between variables. In an ML context, linear regression finds the relationship between features and a label.
For example, suppose we want to predict a car's fuel efficiency in miles per gallon based on how heavy the car is, and we have the following dataset:
If we plotted these points, we'd get the following graph:
Figure 1. Car heaviness (in pounds) versus miles per gallon rating. As a car gets heavier, its miles per gallon rating generally decreases.
We could create our own model by drawing a best fit line through the points:
Figure 2. A best fit line drawn through the data from the previous figure.
Linear regression equation In algebraic terms, the model would be defined as y= mx+b. , where
y is miles per gallon—the value we want to predict. m is the slope of the line. x is pounds—our input value. b is the y-intercept. In ML, we write the equation for a linear regression model as follows: y' = b + w₁x₁
where: