Simple linear Regression in Machine Learning
Linear Regression in Machine learning
In simpler words, it is the predictive technique to find future data based upon your past data.
For example, If i have to predict the company's profit based upon their expenses, in this case linear regression is used.
Another example would be based upon the rainfall, how much crop yield.
First we talk about independent and dependent variable:
Independent variable: is that the value does not change or affect when you are trying to do measure.
It is often denoted by 'x'
In above example, expenses is independent variable
Dependent variable: is that the value will be change when you are trying to do measure.
It is often denoted by 'y'
In above example, profit is the dependent variable.
Three types of regression:
1.Simple Linear Regression:
2.Multiple Linear Regression:
3.Polynomial Linear Regression:
Where Linear regression can be used?
To predict the product price.
It can also be used in real estate, for example, how much price of the house in coming years.
It can also be used in games, like to predict the number of runs a player would score in the coming matches based on previous performance.
What is Linear regression:
It is a model to predict the relationship between dependent and independent variable.
Let's dig into the equation:
Regression equation:
y=m*x+c
y=dependent variable
x=Independent variable
m=slope of the line
c=coefficient of the line
How to find slope of the line
m=y2-y1/x2-x1
y=(0.6*3)+2.2
y=4
Now, we will find the predicted value,
For x=1,
0.6*1+2.2=2.8
For x=2,
0.6*2+2.2=3.4
For x=3,
0.6*3+2.2=4
For x=4,
0.6*4+2.2=4.6
For x=5,
0.6*5+2.2=5.2
So, now what is Residual Errors:
The distance between actual and predicted values are known as Residual Errors.
So, putting predicted value in graph , you can find the best fit line.
How to find the best fit line in other ways:
Minimizing the distance:
There are many ways to minimize the distance between the line and data points like sum of squared errors, Sum of absolute errors, Root mean squared error etc.
References:
To watch more about the linear regression
Thanks For Reading and Happy Coding💜
Comments
Post a Comment