In linear regression, we assume a linear relationship between the independent variables and the dependent variable. Linear regression is represented as follows:
In the given equation:
- Y is the dependent variable
- W is the weight associated with the independent variable X
- b is the intercept value
If there are multiple independent variables (let's say two independent variables, x1 and x2), the equation is as follows:
In the given equation:
- w1 is the weight associated with variable x1
- w2 is the weight associated with variable x2
A typical linear regression looks as follows, where the x axis is the independent variable and the y axis is the dependent variable:
The straight line (with a certain slope and intercept) is the equation of linear regression.
Note that the line in the graph is the one that minimizes the overall squared error.