SlideShare a Scribd company logo
LINEAR
REGRESSION
I N P Y T H O N
Type of Supervised Learning
Algorithm.
Regression refers to searching for
relationship between variables.
Simplest type of regression, used
Use Cases: predict sales, predict impact
of change of predictor, forecast, risk
assessment, check for trends
when variables are "linearly" related
WHAT IS IT?
Works on linear relationship of
variables
Example, lets have a small table:
Here, y is a dependent variable, which
depends on x.
MATH BEHIND
Find the best fit line, which goes or is
close to almost every point in the table
(data)
Let's suppose a line l passes through it.
l can be defined as:
It is the slope intercept form of line.
m is slope and c is the intercept for the
line which passes from (x,y)
y = m . x + c
GOAL
Let's suppose, the best fit line passes
through x mean and y mean.
(3, 3.6) is the mean point for the tabular
data
MATH
Slope, m of the line:
If the line passes through (3, 3.6) and
have slope m as 0.4, we can easily
determine 'c' by subsituting the values
and solving for 'c'.
3.6 = 0.4 (3) + c
Thus, c comes to be 2.4
MATH
2
The equation of lines comes to be:
This is our regression line.
Y (pred) are the predicted y values
corresponding to the x values
y = (0.4) x + 2.4
MATH
We calculate the accuracy by R-Square
method. 1 - R2 is the error
HOW PERFECT IS IT?
= = 0.3
Implementing the linear regression
using scikit learn.
SCIKIT LEARN

More Related Content

DOCX
Correlation Example
PPTX
Stats 3000 Week 2 - Winter 2011
PDF
9. parametric regression
PDF
5.4 Slope Intercept Form
PPTX
PPTX
What is Simple Linear Regression and How Can an Enterprise Use this Technique...
PPT
Exploring bivariate data
PPTX
Linear regression
Correlation Example
Stats 3000 Week 2 - Winter 2011
9. parametric regression
5.4 Slope Intercept Form
What is Simple Linear Regression and How Can an Enterprise Use this Technique...
Exploring bivariate data
Linear regression

What's hot (19)

PDF
Reliability Plotting Explained
PPTX
Correlation Statistics
PPTX
Simple Linear Regression: Step-By-Step
PDF
Overview of Advance Marketing Research
PPT
More tabs
PDF
Linear regression
PPT
Statistics
PPT
Statistics
PPTX
Machine Learning-Linear regression
PPT
Regression
PPT
Pc8 6 parametric equations
PDF
Chapter 2 part3-Least-Squares Regression
PDF
Linear regreesion ppt
PPT
5 6 Scatter Plots & Best Fit Lines
PDF
correlation_and_covariance
PPTX
Chapter 16: Correlation (enhanced by VisualBee)
PPTX
Correlation and regression
PPT
Regression
Reliability Plotting Explained
Correlation Statistics
Simple Linear Regression: Step-By-Step
Overview of Advance Marketing Research
More tabs
Linear regression
Statistics
Statistics
Machine Learning-Linear regression
Regression
Pc8 6 parametric equations
Chapter 2 part3-Least-Squares Regression
Linear regreesion ppt
5 6 Scatter Plots & Best Fit Lines
correlation_and_covariance
Chapter 16: Correlation (enhanced by VisualBee)
Correlation and regression
Regression
Ad

Similar to Linear Regression (20)

PPTX
Linear regression.pptx
PPTX
linearregression-1909240jhgg53948.pptx
PPTX
linear regression in machine learning.pptx
PPTX
Ca-1 assignment Machine learning.ygygygpptx
PPTX
Linear Regression final-1.pptx thbejnnej
PPTX
REGRESSION METasdfghjklmjhgftrHODS1.pptx
PPTX
Regression (Linear Regression and Logistic Regression) by Akanksha Bali
PPTX
MachineLearning_Unit-II.pptxScrum.pptxAgile Model.pptxAgile Model.pptxAgile M...
PDF
MachineLearning_Unit-II.FHDGFHJKpptx.pdf
PDF
Module 5.pdf Machine Learning Types and examples
PPTX
Artifical Intelligence And Machine Learning Algorithum.pptx
PPTX
Lecture 8 Linear and Multiple Regression (1).pptx
PPTX
ML-UNIT-IV complete notes download here
PPTX
Regression analysis by akanksha Bali
PPTX
Regression Analysis.pptx
PPTX
Regression Analysis Techniques.pptx
PDF
The normal presentation about linear regression in machine learning
PDF
3ml.pdf
PPTX
unit 3 regression.pptx
PPTX
Introduction-to-Linear-Regression-Concepts-Application-and-Interpretation.pptx
Linear regression.pptx
linearregression-1909240jhgg53948.pptx
linear regression in machine learning.pptx
Ca-1 assignment Machine learning.ygygygpptx
Linear Regression final-1.pptx thbejnnej
REGRESSION METasdfghjklmjhgftrHODS1.pptx
Regression (Linear Regression and Logistic Regression) by Akanksha Bali
MachineLearning_Unit-II.pptxScrum.pptxAgile Model.pptxAgile Model.pptxAgile M...
MachineLearning_Unit-II.FHDGFHJKpptx.pdf
Module 5.pdf Machine Learning Types and examples
Artifical Intelligence And Machine Learning Algorithum.pptx
Lecture 8 Linear and Multiple Regression (1).pptx
ML-UNIT-IV complete notes download here
Regression analysis by akanksha Bali
Regression Analysis.pptx
Regression Analysis Techniques.pptx
The normal presentation about linear regression in machine learning
3ml.pdf
unit 3 regression.pptx
Introduction-to-Linear-Regression-Concepts-Application-and-Interpretation.pptx
Ad

Recently uploaded (20)

PDF
ENT215_Completing-a-large-scale-migration-and-modernization-with-AWS.pdf
PPTX
OMC Textile Division Presentation 2021.pptx
PDF
Encapsulation_ Review paper, used for researhc scholars
PPTX
A Presentation on Touch Screen Technology
PDF
Approach and Philosophy of On baking technology
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Hybrid model detection and classification of lung cancer
PDF
Getting Started with Data Integration: FME Form 101
PDF
DP Operators-handbook-extract for the Mautical Institute
PDF
A comparative study of natural language inference in Swahili using monolingua...
PDF
NewMind AI Weekly Chronicles - August'25-Week II
PDF
Transform Your ITIL® 4 & ITSM Strategy with AI in 2025.pdf
PDF
gpt5_lecture_notes_comprehensive_20250812015547.pdf
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
WOOl fibre morphology and structure.pdf for textiles
PDF
1 - Historical Antecedents, Social Consideration.pdf
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
project resource management chapter-09.pdf
PPTX
A Presentation on Artificial Intelligence
PPTX
1. Introduction to Computer Programming.pptx
ENT215_Completing-a-large-scale-migration-and-modernization-with-AWS.pdf
OMC Textile Division Presentation 2021.pptx
Encapsulation_ Review paper, used for researhc scholars
A Presentation on Touch Screen Technology
Approach and Philosophy of On baking technology
Building Integrated photovoltaic BIPV_UPV.pdf
Hybrid model detection and classification of lung cancer
Getting Started with Data Integration: FME Form 101
DP Operators-handbook-extract for the Mautical Institute
A comparative study of natural language inference in Swahili using monolingua...
NewMind AI Weekly Chronicles - August'25-Week II
Transform Your ITIL® 4 & ITSM Strategy with AI in 2025.pdf
gpt5_lecture_notes_comprehensive_20250812015547.pdf
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
WOOl fibre morphology and structure.pdf for textiles
1 - Historical Antecedents, Social Consideration.pdf
Agricultural_Statistics_at_a_Glance_2022_0.pdf
project resource management chapter-09.pdf
A Presentation on Artificial Intelligence
1. Introduction to Computer Programming.pptx

Linear Regression

  • 2. Type of Supervised Learning Algorithm. Regression refers to searching for relationship between variables. Simplest type of regression, used Use Cases: predict sales, predict impact of change of predictor, forecast, risk assessment, check for trends when variables are "linearly" related WHAT IS IT?
  • 3. Works on linear relationship of variables Example, lets have a small table: Here, y is a dependent variable, which depends on x. MATH BEHIND
  • 4. Find the best fit line, which goes or is close to almost every point in the table (data) Let's suppose a line l passes through it. l can be defined as: It is the slope intercept form of line. m is slope and c is the intercept for the line which passes from (x,y) y = m . x + c GOAL
  • 5. Let's suppose, the best fit line passes through x mean and y mean. (3, 3.6) is the mean point for the tabular data MATH
  • 6. Slope, m of the line: If the line passes through (3, 3.6) and have slope m as 0.4, we can easily determine 'c' by subsituting the values and solving for 'c'. 3.6 = 0.4 (3) + c Thus, c comes to be 2.4 MATH 2
  • 7. The equation of lines comes to be: This is our regression line. Y (pred) are the predicted y values corresponding to the x values y = (0.4) x + 2.4 MATH
  • 8. We calculate the accuracy by R-Square method. 1 - R2 is the error HOW PERFECT IS IT? = = 0.3
  • 9. Implementing the linear regression using scikit learn. SCIKIT LEARN