0% found this document useful (0 votes)
9 views

What Is Linear Regression

Uploaded by

Thapelo
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views

What Is Linear Regression

Uploaded by

Thapelo
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 14

What is Linear Regression ?

Linear regression is a type of supervised machine learning algorithm


that computes the linear relationship between a dependent variable
and one or more independent features.

In its simplest form, it is a linear model using the Least Squares


method.

Improved forms of linear regression, ridge regression, lasso


regression, ridge regression with cross validation etc. are usually
preferred for relatively complex datasets.

How does Linear Regression work ?

Linear Regression is a statistical method that is used to find an


association between a dependent / target variable and independent
/ predictor variable or variable.

It is used to predict/classify an unknown attribute or value based


on its relationship with known values.

Given the independent and dependent variables and their values


plotted, it works by trying to find a line that can best
capture the underlying trend, so it can better predict an
unknown value.

A few examples are :


1. The weight of a person, with respect to their height.

2. Organizations would like to understand the relationship


between the sales outcome with respect to expenditure
in advertising/promotion.

3. Existing weather data can be used to provide a weather


prediction.

What is the formula of Linear Regression ?

The basic formula for Linear Regression for individual data points
with one variable is, taking x as the independent variable and y as
the target variable.
Types of Linear Regression

Simple linear regression

 Simple linear regression or SLR is a statistical model


used when only one independent variable is present, and
the functional relationship between the outcome variable
is linear.

 Equation :
Multiple linear regression

 Multiple linear regression is a statistical model used for


finding a relationship/association between a set of
independent variables and a dependent variable.

 Equation :

Linear Regression models in Python

In Python, Linear regression can be implemented from


the statsmodels and the scikit-learn library :

statsmodels.regression.linear_model.OLS

OLS is a method of estimating the parameters of a linear regression


model by minimizing the sum of the squared differences between
the predicted and actual values.
Statsmodels OLS provides a detailed summary of the model,
including information such as the coefficients, standard errors, t-
values, and p-values for each predictor variable.

sklearn.linear_model.LinearRegression

The Scikit-Learn Linear Regression model is a simple linear


regression model that estimates the parameters of a linear
regression model by minimizing the sum of the squared differences
between the predicted and actual values.

Scikit-Learn Linear Regression, on the other hand, provides a


simpler output that includes the coefficients and intercept of the
model.

In the follow up blogs, we’ll see a sample linear regression project


using the above models.

Read more on linear regression :

1. https://www.geeksforgeeks.org/ml-linear-regression/

2. https://www.javatpoint.com/linear-regression-in-
machine-learning

3. https://towardsdatascience.com/linear-regression-
detailed-view-ea73175f6e86

4. http://www.stat.yale.edu/Courses/1997-98/101/
linreg.htm
Machine Learning

Regression

Data Science

Linear Regression

Artificial Intelligence

Written by Shivang Kainthola


13 Followers
Follow
More from Shivang Kainthola
Shivang Kainthola

Machine Learning : Ridge Regression


What is Ridge Regression ?

Dec 26, 2023

7
Shivang Kainthola

Machine Learning : Lasso Regression


What is Lasso Regression ?

Dec 30, 2023

6
Shivang Kainthola

The basics of Pandas library


Pandas is a Python library used for carrying out data analysis and
manipulation. For any data-related task, having a good knowledge
of…

Aug 31, 2023


Shivang Kainthola

Machine Learning : Elastic Net Regression


Best of both worlds, lasso and ridge!

Jan 24

See all from Shivang Kainthola

Recommended from Medium

You might also like