Linear Regression
1. Regression Model
In statistics, linear regression is a linear approach to modelling the relationship between a dependent variable and one or more independent variables. Let be the independent variable and be the dependent variable. We will define a linear relationship between these two variables as follows:
2. Define Loss Function
We will use the Mean Squared Error function.
3. Utilize the Gradient Descent Algorithm
You might know that the partial derivative of a function at its minimum value is equal to 0. So gradient descent basically uses this concept to estimate the parameters or weights of our model by minimizing the loss function.
Initialize the weights, and
Calculate the partial derivatives w.r.t. to and
Update the weights
Python Implementation
Last updated
Was this helpful?