SlideShare a Scribd company logo
1 of 18
NADAR SARASWATHI COLLEGE OF ARTS AND SCIENCE,
VADAPUTHUPATTI,THENI.
LINEARREGRESSION,STEPSIN BUILDINGA REGRESSIONMODEL.
PRESENTED BY:
AISHWARYA LAKSHMI. S II-MSC (CS)
LINEAR REGRESSION IN MACHINE LEARNING
Linear regression is one of the easiest and most popular
Machine Learning algorithms.
• 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.
• 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 IN MACHINE LEARNING
• Since linear regression shows the linear relationship, which
means it finds how the value of the dependent variable is
changing according to the value of the independent variable.
• The linear regression model provides a sloped straight line
representing the relationship between the variables. Consider
the below image:
LINEAR REGRESSION IN MACHINE LEARNING
TYPES OF LINEAR REGRESSION
• Linear regression can be further divided into two types of the algorithm:
• SimpleLinearRegression:
If a single independent variable is used to predict the value of a numerical
dependent variable, then such a Linear Regression algorithm is called
Simple Linear Regression.
• MultipleLinearregression:
If more than one independent variable is used to predict the value of a
numerical dependent variable, then such a Linear Regression algorithm is
called Multiple Linear Regression.
LINEAR REGRESSION LINE
• A linear line showing the relationship between the dependent and independent
variables is called a regression line. A regression line can show two types of
relationship:
• PositiveLinearRelationship:
If the dependent variable increases on the Y-axis and independent variable
increases on X-axis, then such a relationship is termed as a Positive linear
relationship.
NEGATIVE LINEAR RELATIONSHIP
• If the dependent variable decreases on the Y-axis and independent
variable increases on the X-axis, then such a relationship is called a
negative linear relationship.
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 for weights or the 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.
COST FUNCTION
• The different values for weights or coefficient of lines (a0, a1) gives the
different line of regression, and the cost function is used to estimate the
values of the coefficient for the best fit line.
• Cost function optimizes the regression coefficients or weights. It
measures how a linear regression model is performing.
• We can use the cost function to find the accuracy of the mapping
function, which maps the input variable to the output variable. This
mapping function is also known as Hypothesis function.
GRADIENT DESCENT
• Gradient descent is used to minimize the MSE by calculating the
gradient of the cost function.
• A regression model uses gradient descent to update the coefficients of the
line by reducing the cost function.
• It is done by a random selection of values of coefficient and then
iteratively update the values to reach the minimum cost function.
MODEL PERFORMANCE
The Goodness of fit determines how the line of regression fits the set of
observations. The process of finding the best model out of various models is called optimization. It can be
achieved by below method:
1. R-squared method:
• R-squared is a statistical method that determines the goodness of fit.
• It measures the strength of the relationship between the dependent and independent variables on a scale of 0-
100%.
• The high value of R-square determines the less difference between the predicted values and actual values and
hence represents a good model.
• It is also called a coefficient of determination, or coefficient of multiple determination for multiple regression.
• It can be calculated from the below formula:
ASSUMPTIONS OF LINEAR REGRESSION
Below are some important assumptions of
Linear Regression. These are some formal checks while
building a Linear Regression model, which ensures to
get the best possible result from the given dataset.
LINEAR RELATIONSHIP BETWEEN THE
FEATURES AND TARGET
Linear regression assumes the linear
relationship between the dependent and independent
variables.
SMALL OR NO MULTICOLLINEARITY BETWEEN THE
FEATURES
• Multicollinearity means high-correlation between the independent
variables. Due to multicollinearity, it may difficult to find the true
relationship between the predictors and target variables.
• Or we can say, it is difficult to determine which predictor variable is
affecting the target variable and which is not.
• So, the model assumes either little or no multicollinearity between the
features or independent variables.
HOMOSCEDASTICITY ASSUMPTION
Homoscedasticity is a situation when the error
term is the same for all the values of independent
variables. With homoscedasticity, there should be no
clear pattern distribution of data in the scatter plot.
NORMAL DISTRIBUTION OF ERROR TERMS
• Linear regression assumes that the error term should follow the normal
distribution pattern.
• If error terms are not normally distributed, then confidence intervals will
become either too wide or too narrow, which may cause finding coefficients.
• It can be checked using the q-q plot. If the plot shows a straight line without
any deviation, which means the error is normally distributed.
NO AUTOCORRELATIONS
• The linear regression model assumes no autocorrelation in
error terms. If there will be any correlation in the error term,
then it will drastically reduce the accuracy of the model.
• Autocorrelation usually occurs if there is a dependency
between residual errors.
THANK YOU!!!

More Related Content

Similar to Artifical Intelligence And Machine Learning Algorithum.pptx

Machine Learning-Linear regression
Machine Learning-Linear regressionMachine Learning-Linear regression
Machine Learning-Linear regressionkishanthkumaar
 
A presentation for Multiple linear regression.ppt
A presentation for Multiple linear regression.pptA presentation for Multiple linear regression.ppt
A presentation for Multiple linear regression.pptvigia41
 
Asset Relationship - CH 8 - Regression | CMT Level 3 | Chartered Market Techn...
Asset Relationship - CH 8 - Regression | CMT Level 3 | Chartered Market Techn...Asset Relationship - CH 8 - Regression | CMT Level 3 | Chartered Market Techn...
Asset Relationship - CH 8 - Regression | CMT Level 3 | Chartered Market Techn...Professional Training Academy
 
how to select the appropriate method for our study of interest
how to select the appropriate method for our study of interest how to select the appropriate method for our study of interest
how to select the appropriate method for our study of interest NurFathihaTahiatSeeu
 
Introduction-to-Linear-Regression.pptx
Introduction-to-Linear-Regression.pptxIntroduction-to-Linear-Regression.pptx
Introduction-to-Linear-Regression.pptxengdlshadfm
 
REGRESSION METasdfghjklmjhgftrHODS1.pptx
REGRESSION METasdfghjklmjhgftrHODS1.pptxREGRESSION METasdfghjklmjhgftrHODS1.pptx
REGRESSION METasdfghjklmjhgftrHODS1.pptxcajativ595
 
Regression & correlation coefficient
Regression & correlation coefficientRegression & correlation coefficient
Regression & correlation coefficientMuhamamdZiaSamad
 
STATISTICAL REGRESSION MODELS
STATISTICAL REGRESSION MODELSSTATISTICAL REGRESSION MODELS
STATISTICAL REGRESSION MODELSAneesa K Ayoob
 
NPTL Machine Learning Week 2.docx
NPTL Machine Learning Week 2.docxNPTL Machine Learning Week 2.docx
NPTL Machine Learning Week 2.docxMr. Moms
 
Introduction-to-Non-Linear-Regression.pptx
Introduction-to-Non-Linear-Regression.pptxIntroduction-to-Non-Linear-Regression.pptx
Introduction-to-Non-Linear-Regression.pptxShriramKargaonkar
 
Exploring bivariate data
Exploring bivariate dataExploring bivariate data
Exploring bivariate dataUlster BOCES
 
Linear Regression | Machine Learning | Data Science
Linear Regression | Machine Learning | Data ScienceLinear Regression | Machine Learning | Data Science
Linear Regression | Machine Learning | Data ScienceSumit Pandey
 
Correlation.pptx
Correlation.pptxCorrelation.pptx
Correlation.pptxIloveBepis
 

Similar to Artifical Intelligence And Machine Learning Algorithum.pptx (20)

Machine Learning-Linear regression
Machine Learning-Linear regressionMachine Learning-Linear regression
Machine Learning-Linear regression
 
A presentation for Multiple linear regression.ppt
A presentation for Multiple linear regression.pptA presentation for Multiple linear regression.ppt
A presentation for Multiple linear regression.ppt
 
Linear regression
Linear regressionLinear regression
Linear regression
 
Asset Relationship - CH 8 - Regression | CMT Level 3 | Chartered Market Techn...
Asset Relationship - CH 8 - Regression | CMT Level 3 | Chartered Market Techn...Asset Relationship - CH 8 - Regression | CMT Level 3 | Chartered Market Techn...
Asset Relationship - CH 8 - Regression | CMT Level 3 | Chartered Market Techn...
 
how to select the appropriate method for our study of interest
how to select the appropriate method for our study of interest how to select the appropriate method for our study of interest
how to select the appropriate method for our study of interest
 
Introduction-to-Linear-Regression.pptx
Introduction-to-Linear-Regression.pptxIntroduction-to-Linear-Regression.pptx
Introduction-to-Linear-Regression.pptx
 
REGRESSION METasdfghjklmjhgftrHODS1.pptx
REGRESSION METasdfghjklmjhgftrHODS1.pptxREGRESSION METasdfghjklmjhgftrHODS1.pptx
REGRESSION METasdfghjklmjhgftrHODS1.pptx
 
Multiple Linear Regression
Multiple Linear Regression Multiple Linear Regression
Multiple Linear Regression
 
Regression & correlation coefficient
Regression & correlation coefficientRegression & correlation coefficient
Regression & correlation coefficient
 
MF Presentation.pptx
MF Presentation.pptxMF Presentation.pptx
MF Presentation.pptx
 
ml-05x01.pdf
ml-05x01.pdfml-05x01.pdf
ml-05x01.pdf
 
STATISTICAL REGRESSION MODELS
STATISTICAL REGRESSION MODELSSTATISTICAL REGRESSION MODELS
STATISTICAL REGRESSION MODELS
 
Regression analysis
Regression analysisRegression analysis
Regression analysis
 
NPTL Machine Learning Week 2.docx
NPTL Machine Learning Week 2.docxNPTL Machine Learning Week 2.docx
NPTL Machine Learning Week 2.docx
 
Econometrics chapter 8
Econometrics chapter 8Econometrics chapter 8
Econometrics chapter 8
 
Introduction-to-Non-Linear-Regression.pptx
Introduction-to-Non-Linear-Regression.pptxIntroduction-to-Non-Linear-Regression.pptx
Introduction-to-Non-Linear-Regression.pptx
 
Exploring bivariate data
Exploring bivariate dataExploring bivariate data
Exploring bivariate data
 
Regression
Regression Regression
Regression
 
Linear Regression | Machine Learning | Data Science
Linear Regression | Machine Learning | Data ScienceLinear Regression | Machine Learning | Data Science
Linear Regression | Machine Learning | Data Science
 
Correlation.pptx
Correlation.pptxCorrelation.pptx
Correlation.pptx
 

More from Aishwarya SenthilNathan (13)

cloud computing.pptx
cloud computing.pptxcloud computing.pptx
cloud computing.pptx
 
IOT.pptx
IOT.pptxIOT.pptx
IOT.pptx
 
women empowerment.pptx
women empowerment.pptxwomen empowerment.pptx
women empowerment.pptx
 
Digital Image Processing.pptx
Digital Image Processing.pptxDigital Image Processing.pptx
Digital Image Processing.pptx
 
Cloud Computing.pptx
Cloud Computing.pptxCloud Computing.pptx
Cloud Computing.pptx
 
SENTIMENT ANALYSIS OF FEEDBACK DATA USING MACHINE LEARNING TECHNIQUE.pptx
SENTIMENT ANALYSIS OF FEEDBACK DATA USING MACHINE LEARNING TECHNIQUE.pptxSENTIMENT ANALYSIS OF FEEDBACK DATA USING MACHINE LEARNING TECHNIQUE.pptx
SENTIMENT ANALYSIS OF FEEDBACK DATA USING MACHINE LEARNING TECHNIQUE.pptx
 
2D Graphics animation - Bouncing ball(Python).pptx
2D Graphics animation - Bouncing ball(Python).pptx2D Graphics animation - Bouncing ball(Python).pptx
2D Graphics animation - Bouncing ball(Python).pptx
 
Growth Of IOT NETWORK.pptx
Growth Of IOT NETWORK.pptxGrowth Of IOT NETWORK.pptx
Growth Of IOT NETWORK.pptx
 
DATA MINING.pptx
DATA MINING.pptxDATA MINING.pptx
DATA MINING.pptx
 
Software Engineering.pptx
Software Engineering.pptxSoftware Engineering.pptx
Software Engineering.pptx
 
HUMANOID ROBOTS.pptx
HUMANOID ROBOTS.pptxHUMANOID ROBOTS.pptx
HUMANOID ROBOTS.pptx
 
LR PARSE.pptx
LR PARSE.pptxLR PARSE.pptx
LR PARSE.pptx
 
APPLET.pptx
APPLET.pptxAPPLET.pptx
APPLET.pptx
 

Recently uploaded

Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfUjwalaBharambe
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersSabitha Banu
 
Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxAvyJaneVismanos
 
Capitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitolTechU
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Celine George
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfadityarao40181
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementmkooblal
 
Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...jaredbarbolino94
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 

Recently uploaded (20)

Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginners
 
Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptx
 
Capitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptx
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdf
 
ESSENTIAL of (CS/IT/IS) class 06 (database)
ESSENTIAL of (CS/IT/IS) class 06 (database)ESSENTIAL of (CS/IT/IS) class 06 (database)
ESSENTIAL of (CS/IT/IS) class 06 (database)
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of management
 
OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...
 
Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 

Artifical Intelligence And Machine Learning Algorithum.pptx

  • 1. NADAR SARASWATHI COLLEGE OF ARTS AND SCIENCE, VADAPUTHUPATTI,THENI. LINEARREGRESSION,STEPSIN BUILDINGA REGRESSIONMODEL. PRESENTED BY: AISHWARYA LAKSHMI. S II-MSC (CS)
  • 2. LINEAR REGRESSION IN MACHINE LEARNING Linear regression is one of the easiest and most popular Machine Learning algorithms. • 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. • Linear regression algorithm shows a linear relationship between a dependent (y) and one or more independent (y) variables, hence called as linear regression.
  • 3. LINEAR REGRESSION IN MACHINE LEARNING • Since linear regression shows the linear relationship, which means it finds how the value of the dependent variable is changing according to the value of the independent variable. • The linear regression model provides a sloped straight line representing the relationship between the variables. Consider the below image:
  • 4. LINEAR REGRESSION IN MACHINE LEARNING
  • 5. TYPES OF LINEAR REGRESSION • Linear regression can be further divided into two types of the algorithm: • SimpleLinearRegression: If a single independent variable is used to predict the value of a numerical dependent variable, then such a Linear Regression algorithm is called Simple Linear Regression. • MultipleLinearregression: If more than one independent variable is used to predict the value of a numerical dependent variable, then such a Linear Regression algorithm is called Multiple Linear Regression.
  • 6. LINEAR REGRESSION LINE • A linear line showing the relationship between the dependent and independent variables is called a regression line. A regression line can show two types of relationship: • PositiveLinearRelationship: If the dependent variable increases on the Y-axis and independent variable increases on X-axis, then such a relationship is termed as a Positive linear relationship.
  • 7. NEGATIVE LINEAR RELATIONSHIP • If the dependent variable decreases on the Y-axis and independent variable increases on the X-axis, then such a relationship is called a negative linear relationship.
  • 8. 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 for weights or the 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.
  • 9. COST FUNCTION • The different values for weights or coefficient of lines (a0, a1) gives the different line of regression, and the cost function is used to estimate the values of the coefficient for the best fit line. • Cost function optimizes the regression coefficients or weights. It measures how a linear regression model is performing. • We can use the cost function to find the accuracy of the mapping function, which maps the input variable to the output variable. This mapping function is also known as Hypothesis function.
  • 10. GRADIENT DESCENT • Gradient descent is used to minimize the MSE by calculating the gradient of the cost function. • A regression model uses gradient descent to update the coefficients of the line by reducing the cost function. • It is done by a random selection of values of coefficient and then iteratively update the values to reach the minimum cost function.
  • 11. MODEL PERFORMANCE The Goodness of fit determines how the line of regression fits the set of observations. The process of finding the best model out of various models is called optimization. It can be achieved by below method: 1. R-squared method: • R-squared is a statistical method that determines the goodness of fit. • It measures the strength of the relationship between the dependent and independent variables on a scale of 0- 100%. • The high value of R-square determines the less difference between the predicted values and actual values and hence represents a good model. • It is also called a coefficient of determination, or coefficient of multiple determination for multiple regression. • It can be calculated from the below formula:
  • 12. ASSUMPTIONS OF LINEAR REGRESSION Below are some important assumptions of Linear Regression. These are some formal checks while building a Linear Regression model, which ensures to get the best possible result from the given dataset.
  • 13. LINEAR RELATIONSHIP BETWEEN THE FEATURES AND TARGET Linear regression assumes the linear relationship between the dependent and independent variables.
  • 14. SMALL OR NO MULTICOLLINEARITY BETWEEN THE FEATURES • Multicollinearity means high-correlation between the independent variables. Due to multicollinearity, it may difficult to find the true relationship between the predictors and target variables. • Or we can say, it is difficult to determine which predictor variable is affecting the target variable and which is not. • So, the model assumes either little or no multicollinearity between the features or independent variables.
  • 15. HOMOSCEDASTICITY ASSUMPTION Homoscedasticity is a situation when the error term is the same for all the values of independent variables. With homoscedasticity, there should be no clear pattern distribution of data in the scatter plot.
  • 16. NORMAL DISTRIBUTION OF ERROR TERMS • Linear regression assumes that the error term should follow the normal distribution pattern. • If error terms are not normally distributed, then confidence intervals will become either too wide or too narrow, which may cause finding coefficients. • It can be checked using the q-q plot. If the plot shows a straight line without any deviation, which means the error is normally distributed.
  • 17. NO AUTOCORRELATIONS • The linear regression model assumes no autocorrelation in error terms. If there will be any correlation in the error term, then it will drastically reduce the accuracy of the model. • Autocorrelation usually occurs if there is a dependency between residual errors.