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

IDS UNIT 5 Linear Regression

Uploaded by

Avyuktha Raju
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views

IDS UNIT 5 Linear Regression

Uploaded by

Avyuktha Raju
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 27

Linear Regression

Introduction: Linear Regression in Machine learning

• Machine Learning is a branch of Artificial intelligence that


focuses on the development of algorithms and statistical
models that can learn from the data and make predictions
on data.

• Basically, regression is a statistical approach to find the


co-relation between variables(dependent and
independent).
• Linear regression algorithm shows a linear relationship between a
dependent (y) and one or more independent (y) variables, hence
called as linear regression.

• Linear regression is a type of supervised machine learning algorithm that


computes the linear relationship between the dependent variable
and one or more independent features by fitting a linear equation on
the observed data.

• It is a statistical method that is used for predictive analysis.

• Linear regression makes predictions for continuous/real or numeric


variables.( such as sales, salary, age, product price, etc.)
• The linear regression model provides a sloped straight
line representing the relationship between the variables.
Consider the below image:
Mathematically, we can represent a linear regression as:
• When there is only one independent variable, it is known as
Simple Linear Regression.
• and when there are more than one independent features, it is
known as Multiple Linear Regression.

• when there is only one dependent variable, it is considered


Univariate Linear Regression.

• when there are more than one dependent variables, it is


known as Multivariate Regression.
Types of Linear Regression

• There are two main types of linear regression:


1.Simple Linear Regression:
This is the simplest form of linear regression, and it involves
only one independent variable and one dependent
variable.

The equation for simple linear regression is:


• 2.Multiple Linear Regression:

This involves more than one independent variable and one


dependent variable.
The equation for multiple linear regression is:
Finding the best fit line:
• When working with linear regression, our main goal is to find the best fit
line that means the error between predicted values and actual
values should be minimized.

• The best fit line will have the least error.

• The different values or coefficient of lines (a0, a1) gives a different line
of regression, so we need to calculate the best values for a0 and
a1 to find the best fit line.

• so to calculate this we use cost function.


example
• Linear equation is given by: Y=a0+a1X
Multiple linear Regression
• Multiple linear regression refers to a statistical technique that uses
two or more independent variables to predict the outcome of a
dependent variable.
• it shows the relationship between two or more independent variables and one
dependent variable.

• it is an extension of linear regression.

• In multiple linear regression the value of dependent variable is predicted based on


more than one independent or explanatory variables.

• Multiple regression can take two forms, i.e., linear regression and
non-linear regression.
You can use multiple linear regression when
you want to know
1.How strong the relationship is between two or more
independent variables and one dependent variable (e.g. how
rainfall, temperature, and amount of fertilizer added affect crop
growth).

2.The value of the dependent variable at a certain value of the


independent variables (e.g. the expected yield of a crop at
certain levels of rainfall, temperature, and fertilizer addition).
Multiple linear regression formula
Assumptions of Multiple Linear Regression

1.A linear relationship between the dependent and independent variables: The first
assumption of multiple linear regression is that there is a linear relationship between the
dependent variable and each of the independent variables.
2.The independent variables are not highly correlated with each other: The data should not
show multicollinearity, which occurs when the independent variables (explanatory variables)
are highly correlated.
3.The variance of the residuals is constant: Multiple linear regression assumes that the
amount of error in the residuals is similar at each point of the linear model. This scenario is
known as homoscedasticity.

4.Independence of observation: The model assumes that the observations should be


independent of one another.

5.Multivariate normality. Multivariate normality occurs when residuals are normally


distributed.
Example:

You might also like