My Brain Cells

Easiest (and best) learning materials for anyone with a curiosity for machine learning and artificial intelligence, Deep learning, Programming, and other fun life hacks.

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”


Next we import numpy pandas and matplotlib

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

Github Link Cilck Here


Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top