what is linear regression
What is Linear Regression?

What is Linear Regression?

For better understanding about, what is Linear Regression, let me give you some simple example.

Suppose you observe some random employees salary from a particular company. And you notice that person to person this salary vary. You observe that whoever has a good working experience, higher educational degree, good position in the company get a good salary and who doesn’t have working experience or good educational background get poor salary. It means their salary depends on some features, such as working experience, educational degree, designation. Hence salary depends on some features, we can say Salary is a dependent variable. And those features like, working experience, educational degree, designation are not depend on anything. That’s why we can say working experience, educational degree, designation are Independent Variable.

In linear regressing we are trying to establish a relation among dependent variable and independent variable. And from those independent variable, we are trying to make an assumption about dependent variable. We are trying to figure out for some random value of any independent variable, what would be our dependent variable.

  • For instances,
    • 5years of working experience of someone, what would be his/her salary?
    • A CEO of a company, what would be his/her salary?
    • Someone has 6years of working experience as a senior software engineer, what would be his/her salary?


Independent Variable and dependent variable

Linear Regression is actually simple form of regression where we are working with one dependent variable and one independent variable. But if there are two or more independent variables then it called Multilinear Regression.
Its a common practice that, we put our dependent variable into y variable and our independent variable into X variable. But If there are two or more independent variables then put them all into X variable and it called Multilinear Regression.


Example plot about Linear Regression

Linear Regression plot

This is an example plot of Linear Regression where we plot Salary vs. Years of experience and from the plot we can see the positive relation between salary and years of experience. If years of experience increase, the salary also increase and if years of experience decrease then the salary also decrease. From this data, now we can train our dataset and our model can make a prediction about what would be the salary for a given number of years of experience.


If you want to learn how to implement Simple Linear Regression Code in Python, then please check this out
How to Implement Simple Linear Regression in Python

If you want to learn, Datacamp course – “Supervised Learning with scikit-learn” – then click here.

This is all from this blog. Thank you for reading my blog. If you have any query about this explanation, feel free to ask by comment, it would be appreciated. Thank you again. 

Leave a Reply