Recent Posts

linear regression using sklearn

 

What is Linear Regression?

The objective of a linear regression model is to find a relationship between one or more features(independent variables) and a continuous target variable(dependent variable). When there is only feature it is called Uni-variate Linear Regression and if there are multiple features, it is called Multiple Linear Regression.

Where can Linear Regression be used?It is a very powerful technique and can be used to understand the factors that influence profitability. It can be used to forecast sales in the coming months by analyzing the sales data for previous months. It can also be used to gain various insights about customer behavior. By the end of the blog we will build a model which looks like the below picture i.e, determine a line which best fits the data.

Let us take a example of "Employee salaries"

Dataset:-


Next we import numpy pandas and matplotlib



=> Now by using sklearn we build the model:-



Github Link Cilck Here

No comments

If you have any doubts, Please let me know