Member-only story

Linear Regression using Python in 10 lines

Dhiraj K
3 min readMar 21, 2019

--

Do you think that salary of a person is linearly related to his/her years of experience?

Whether your answer is yes or no, I am sure you will want to confirm the right answer… :)

So lets predict how your salary may increase as your years of experience increases :)

So lets find out the salaries and years of experience of 20–30 people from internet (there are many sites where people post their salaries anonymously).

Lets plot the points on a two dimensional plane with salary on Y-axis and Years of Experience on X-axis. You may get the red points like data points as shown in the graph above.

Well, you might have noticed a outlier (a point that is far away from all other points) seems like not fitting into the pattern of all other points. This is called outlier as it lies outside the pattern (the blue straight line here).

The outlier is saying that there is someone having very good salary even if the years of experience is less…

--

--

Dhiraj K
Dhiraj K

Written by Dhiraj K

Data Scientist & Machine Learning Evangelist. I love transforming data into impactful solutions and sharing my knowledge through teaching. dhiraj10099@gmail.com

No responses yet