Today we'll focus on the Simple Linear Regression Cost Function! ๐๐ป
0๏ธโฃ ๐ฅ๐๐๐๐ฃ
In Simple Linear Regression, we use one independent variable to predict a dependent one.
It takes advantage of a line to calculate the slope (A) and intercept (B)
We need:
- A dependent and an independent variable.
- A linear dependency between them.
1๏ธโฃ ๐ช๐๐๐ง ๐๐ฆ ๐ ๐๐ข๐ฆ๐ง ๐๐จ๐ก๐๐ง๐๐ข๐ก?
A cost function helps us work out the optimal values for A and B.
Understand it as a way to find the optimal values for our predictor.
2๏ธโฃ ๐๐ข๐ช ๐๐ข ๐ช๐ ๐ข๐๐ง๐๐๐ก ๐๐ง ๐ ๐๐ง๐๐๐ ๐๐ง๐๐๐๐๐๐ฌ?
In linear regression, this cost function is Mean Squared Errors (MSE).
It is the average of the squared errors.
โ ๐๐ข๐ก๐จ๐ฆ
To find our optimal solutions, we use the gradient descent.
It is one of the optimization algorithms that optimizes the cost function.
To obtain the optimal solution, we need to reduce MSE for all data points.
Iteratively we get closer to the optimal solution.
3๏ธโฃ ๐๐ฉ๐๐๐จ๐๐ง๐๐ข๐ก
The most used metrics are:
- Coefficient of Determination or R-Squared (R2)
- Root Mean Squared Error (RMSE)
4๏ธโฃ ๐๐ฆ๐ฆ๐จ๐ ๐ฃ๐ง๐๐ข๐ก๐ฆ ๐ง๐ข ๐๐ฃ๐ฃ๐๐ฌ ๐๐ง
Linear Regression isn't just about drawing lines.
It assumes certain conditions like linearity, independence, and normal distribution of residuals.
Ensuring these make our model more reliable.
And this is all for now... I'll be posting the whole theory part next Sunday, so stay tuned! ๐ค
Linear Regression is more than just a statistical method.
It's the simplest tool that helps us predict and understand our world better.
And that's all for now
If you liked this thread, I am sharing Data Science and AI content.
So don't forget to follow me to get more content like this! (@rfeers)