SlideShare a Scribd company logo
Linear Regression
What is Regression?
Regression is a supervised learning technique which helps in finding the
correlation between variables and enables us to predict the continuous
output variable based on the one or more predictor variables.
It is mainly used for prediction, forecasting, time series modeling, and
determining the causal-effect relationship between variables. Regression
analysis helps in the prediction of a continuous variable.
Types of Regression
What is Linear Regression?
❏ Linear regression analysis is used to predict the value of a
variable based on the value of another variable
❏ 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.
Types of linear regression
❏ Simple linear regression : The goal of a simple linear regression is to
predict the value of a dependent variable based on an independent
variable. Simple linear regression is used to model the relationship
between two continuous variables. Often, the objective is to predict
the value of an output variable (or response) based on the value of
an input (or predictor) variable.
❏ Multiple linear regression: Multiple linear regression is used to
estimate the relationship between two or more independent
variables and one dependent variable.
Types of linear regression
Equation of Simple linear regression
Y= mX+b
❏ Y represents the dependent variable
❏ X represents the independent variable
❏ m is the slope of the line( how much Y changes
for a unit change in X)
❏ b is the intercept ( the value of Y when X is 0)
Example : Predicting Pizza Prices
Diameter (X) in
Inches
Price(Y) in Dollars
8 10
10 13
12 16
What will be the 20-inch pizza price?
Example : Predicting Pizza Prices
m= sum of product of deviations / sum of square of deviation for x
= 12/8
= 1.5
b= Mean of Y - (m* Mean of X)
= 13 - (1.5*10)
= -2
Y= mX+b
= 1.5X- 2
= 1.5*20-2
= 28 Dollar
Multiple linear regression formula
Example of Multiple Linear Regression
Here, the Matrices for Y and X are
given as follows
Example of Multiple Linear Regression
The Coefficient of the Multiple Regression Equation is given as
Example of Multiple Linear Regression
Example of Multiple Linear Regression
Cost Function in Linear Regression
For the Linear regression model, the cost function will be the minimum
of the Root Mean Squared Error of the model, obtained by subtracting
the predicted values from actual values. It is a numeric value that
indicates the success or failure of a particular model without needing to
understand the inner workings of a model.
Why is the cost function needed?
Basically, our machine learning model predicts the new value. We aim to have
the predicted value as close as possible to the predicted value. If the model
predicts the value close to the actual value, then we will say it’s a good model.
So here is where cost function plays an important role. This cost function is
needed to calculate the difference between actual and predicted values. So
here it is nothing, just the difference between the actual values-predicted
values.
Types of Cost Function in Linear
Regression
Mean error: These errors can be negative or positive. Therefore, they can cancel each
other out during the summation, and the average error of the model will be zero.
Mean Squared Error : MSE represents the average squared difference between the
predictions and expected results.
I = index of sample
Ŷ = predicted value
Y = expected value
M = number of samples in the data set
Types of Cost Function in Linear Regression
Mean Absolute Error: MSE is a variation of MAE that squares the
difference instead of taking the absolute value of the difference.
There is no possibility of negative errors.
I = index of sample
Ŷ = predicted value
Y = expected value
M = number of
samples in the data
set
Types of Cost Function in Linear Regression
Root mean squared error (RMSE): The Root Mean Squared Error (RMSE)
is one of the two main performance indicators for a regression model. It
measures the average difference between values predicted by a model
and the actual values.
Exploring the Cost Function
We have a training set with three points (1, 1), (2, 2), and (3, 3). We plot the
function f(x) = w * x for different values of w and calculate the corresponding cost
function J(w). When w = 1: f(x) = x, the line passes through the origin, perfectly
fitting the data. The cost function J(w) is 0 since f(x) equals y for all training
examples. Setting w = 0.5: f(x) = 0.5 * x, the line has a smaller slope. The cost
function J(w) now measures the squared errors between f(x) and y for each
example. It provides a measure of how well the line fits the data.
Function f(x) vs. Cost Function J(w)
Real-life example of cost function
Here, y denotes the target variable(Price of House), X denotes the size of the
House and a0 is the intercept. The linear regression model will fit a straight line
to our data, as shown in fig, and it will tell us what is the price of the House when
we know the size of the House. Suppose this housing company sells houses
having areas under 600 to 1500 square feet. So the prices will vary according to
the size of the plot. For example
House(1200 to 1500 square feet)= 65 lakhs.
Now suddenly, there’s a rise in demand of Houses which means the price of this
House will increase now. Suppose the price has now increased to 75 lakhs. But
what if the model predicted its price as 30 lakhs? So this difference between
these actual and predicted values is calculated by the cost function.
Applications of Linear Regression
❏ Market analysis
❏ Financial analysis
❏ Sports analysis
❏ Environmental health
❏ Medicine
Advantages of Linear Regression
❏ Linear Regression is simple to implement and easier to interpret the output
coefficients
❏ When you know the relationship between the independent and dependent
variable have a linear relationship, this algorithm is the best to use because of
it’s less complexity compared to other algorithms.
❏ Linear Regression is susceptible to over-fitting but it can be avoided using some
dimensionality reduction techniques, regularization (L1 and L2) techniques and
cross-validation.
Drawbacks of Linear Regression
❏ Linear Assumption
❏ Sensitivity to Exceptions
❏ Independence Presumption
❏ Limited to Linear Relationships
Conclusion
Linear regression is a foundational and widely used
technique in machine learning, offering a straightforward
yet effective way to model relationships between variables.
It is a valuable tool for making predictions and
understanding data patterns, though its suitability depends
on the specific problem and the linearity assumption. While
it may not always be the best choice, it remains an essential
component of the machine learning toolkit, providing
valuable insights in various domains.
References
❖ https://www.geeksforgeeks.org/ml-advantages-and-disadvantages-of-linear-
regression/
❖ https://iq.opengenus.org/advantages-and-disadvantages-of-linear-regression/
❖ https://www.intellspot.com/linear-regression-examples/
❖ https://www.tutorialspoint.com/advantages-and-disadvantages-of-linear-
regression#:~:text=The%20strategy%20is%20simple%20to,the%20subordinate%20and
%20free%20factors.
❖ https://sphweb.bumc.bu.edu/otlt/MPH-Modules/BS/BS704-
EP713_MultivariableMethods/
❖ https://www.javatpoint.com/simple-linear-regression-in-machine-learning
❖ https://youtu.be/zUQr6HAAKp4?si=V-ojf6pXnMO2p7DR
❖ https://youtu.be/lzGKRSvs5HM?si=RduTOfWWjb05n5tF
❖ https://www.shiksha.com/online-courses/articles/cost-function-in-machine-
learning/#Why-is-the-cost-function-needed?
❖ https://medium.com/@yennhi95zz/3-understanding-the-cost-function-in-linear-regression-for-
machine-learning-beginners-ec9edeecbdde
❖ https://datatab.net/tutorial/linear-regression
❖ https://www.youtube.com/watch?v=QcPycBZomac
Thank You

More Related Content

What's hot

Visual Explanation of Ridge Regression and LASSO
Visual Explanation of Ridge Regression and LASSOVisual Explanation of Ridge Regression and LASSO
Visual Explanation of Ridge Regression and LASSO
Kazuki Yoshida
 
Implement principal component analysis (PCA) in python from scratch
Implement principal component analysis (PCA) in python from scratchImplement principal component analysis (PCA) in python from scratch
Implement principal component analysis (PCA) in python from scratch
EshanAgarwal4
 
Machine Learning - Simple Linear Regression
Machine Learning - Simple Linear RegressionMachine Learning - Simple Linear Regression
Machine Learning - Simple Linear Regression
Siddharth Shrivastava
 
Deep Dive into Hyperparameter Tuning
Deep Dive into Hyperparameter TuningDeep Dive into Hyperparameter Tuning
Deep Dive into Hyperparameter Tuning
Shubhmay Potdar
 
Data visualization tools & techniques - 1
Data visualization tools & techniques - 1Data visualization tools & techniques - 1
Data visualization tools & techniques - 1
Korivi Sravan Kumar
 
Linear regression with gradient descent
Linear regression with gradient descentLinear regression with gradient descent
Linear regression with gradient descent
Suraj Parmar
 
Time series forecasting
Time series forecastingTime series forecasting
Time series forecasting
Firas Kastantin
 
Machine Learning With Logistic Regression
Machine Learning  With Logistic RegressionMachine Learning  With Logistic Regression
Machine Learning With Logistic Regression
Knoldus Inc.
 
Deep Neural Networks (DNN)
Deep Neural Networks (DNN)Deep Neural Networks (DNN)
Logistic regression in Machine Learning
Logistic regression in Machine LearningLogistic regression in Machine Learning
Logistic regression in Machine Learning
Kuppusamy P
 
Machine learning Algorithms
Machine learning AlgorithmsMachine learning Algorithms
Machine learning Algorithms
Walaa Hamdy Assy
 
Gradient descent optimizer
Gradient descent optimizerGradient descent optimizer
Gradient descent optimizer
Hojin Yang
 
Golden Section method
Golden Section methodGolden Section method
Golden Section method
Syed Rubaid Ahmad
 
Logistic regression : Use Case | Background | Advantages | Disadvantages
Logistic regression : Use Case | Background | Advantages | DisadvantagesLogistic regression : Use Case | Background | Advantages | Disadvantages
Logistic regression : Use Case | Background | Advantages | Disadvantages
Rajat Sharma
 
Using matlab simulink
Using matlab simulinkUsing matlab simulink
Using matlab simulink
Marilyn Barragán Castañeda
 
PAC Learning
PAC LearningPAC Learning
PAC Learning
Sanghyuk Chun
 
Basic operators in matlab
Basic operators in matlabBasic operators in matlab
Basic operators in matlab
rishiteta
 
Logistic regression
Logistic regressionLogistic regression
Logistic regression
YashwantGahlot1
 
Regularization and variable selection via elastic net
Regularization and variable selection via elastic netRegularization and variable selection via elastic net
Regularization and variable selection via elastic net
KyusonLim
 
Presentation on supervised learning
Presentation on supervised learningPresentation on supervised learning
Presentation on supervised learning
Tonmoy Bhagawati
 

What's hot (20)

Visual Explanation of Ridge Regression and LASSO
Visual Explanation of Ridge Regression and LASSOVisual Explanation of Ridge Regression and LASSO
Visual Explanation of Ridge Regression and LASSO
 
Implement principal component analysis (PCA) in python from scratch
Implement principal component analysis (PCA) in python from scratchImplement principal component analysis (PCA) in python from scratch
Implement principal component analysis (PCA) in python from scratch
 
Machine Learning - Simple Linear Regression
Machine Learning - Simple Linear RegressionMachine Learning - Simple Linear Regression
Machine Learning - Simple Linear Regression
 
Deep Dive into Hyperparameter Tuning
Deep Dive into Hyperparameter TuningDeep Dive into Hyperparameter Tuning
Deep Dive into Hyperparameter Tuning
 
Data visualization tools & techniques - 1
Data visualization tools & techniques - 1Data visualization tools & techniques - 1
Data visualization tools & techniques - 1
 
Linear regression with gradient descent
Linear regression with gradient descentLinear regression with gradient descent
Linear regression with gradient descent
 
Time series forecasting
Time series forecastingTime series forecasting
Time series forecasting
 
Machine Learning With Logistic Regression
Machine Learning  With Logistic RegressionMachine Learning  With Logistic Regression
Machine Learning With Logistic Regression
 
Deep Neural Networks (DNN)
Deep Neural Networks (DNN)Deep Neural Networks (DNN)
Deep Neural Networks (DNN)
 
Logistic regression in Machine Learning
Logistic regression in Machine LearningLogistic regression in Machine Learning
Logistic regression in Machine Learning
 
Machine learning Algorithms
Machine learning AlgorithmsMachine learning Algorithms
Machine learning Algorithms
 
Gradient descent optimizer
Gradient descent optimizerGradient descent optimizer
Gradient descent optimizer
 
Golden Section method
Golden Section methodGolden Section method
Golden Section method
 
Logistic regression : Use Case | Background | Advantages | Disadvantages
Logistic regression : Use Case | Background | Advantages | DisadvantagesLogistic regression : Use Case | Background | Advantages | Disadvantages
Logistic regression : Use Case | Background | Advantages | Disadvantages
 
Using matlab simulink
Using matlab simulinkUsing matlab simulink
Using matlab simulink
 
PAC Learning
PAC LearningPAC Learning
PAC Learning
 
Basic operators in matlab
Basic operators in matlabBasic operators in matlab
Basic operators in matlab
 
Logistic regression
Logistic regressionLogistic regression
Logistic regression
 
Regularization and variable selection via elastic net
Regularization and variable selection via elastic netRegularization and variable selection via elastic net
Regularization and variable selection via elastic net
 
Presentation on supervised learning
Presentation on supervised learningPresentation on supervised learning
Presentation on supervised learning
 

Similar to Linear Regression

NPTL Machine Learning Week 2.docx
NPTL Machine Learning Week 2.docxNPTL Machine Learning Week 2.docx
NPTL Machine Learning Week 2.docx
Mr. Moms
 
Unit 03 - Consolidated.pptx
Unit 03 - Consolidated.pptxUnit 03 - Consolidated.pptx
Unit 03 - Consolidated.pptx
ChristopherDevakumar1
 
Supervised Learning.pdf
Supervised Learning.pdfSupervised Learning.pdf
Supervised Learning.pdf
gadissaassefa
 
linearregression-1909240jhgg53948.pptx
linearregression-1909240jhgg53948.pptxlinearregression-1909240jhgg53948.pptx
linearregression-1909240jhgg53948.pptx
bishalnandi2
 
working with python
working with pythonworking with python
working with python
bhavesh lande
 
Bootcamp of new world to taken seriously
Bootcamp of new world to taken seriouslyBootcamp of new world to taken seriously
Bootcamp of new world to taken seriously
khaled125087
 
Simple lin regress_inference
Simple lin regress_inferenceSimple lin regress_inference
Simple lin regress_inferenceKemal İnciroğlu
 
Correlation and regression in r
Correlation and regression in rCorrelation and regression in r
Correlation and regression in r
Dr.K.Sreenivas Rao
 
Chapter III.pptx
Chapter III.pptxChapter III.pptx
Chapter III.pptx
Beamlak5
 
Linear_Regression
Linear_RegressionLinear_Regression
Linear_Regression
Mohamed Essam
 
Detail Study of the concept of Regression model.pptx
Detail Study of the concept of  Regression model.pptxDetail Study of the concept of  Regression model.pptx
Detail Study of the concept of Regression model.pptx
truptikulkarni2066
 
Regression Analysis.pptx
Regression Analysis.pptxRegression Analysis.pptx
Regression Analysis.pptx
arsh260174
 
Regression Analysis Techniques.pptx
Regression Analysis Techniques.pptxRegression Analysis Techniques.pptx
Regression Analysis Techniques.pptx
YutaItadori
 
Statistical parameters
Statistical parametersStatistical parameters
Statistical parameters
Burdwan University
 
Machine Learning Unit 3 Semester 3 MSc IT Part 2 Mumbai University
Machine Learning Unit 3 Semester 3  MSc IT Part 2 Mumbai UniversityMachine Learning Unit 3 Semester 3  MSc IT Part 2 Mumbai University
Machine Learning Unit 3 Semester 3 MSc IT Part 2 Mumbai University
Madhav Mishra
 
MF Presentation.pptx
MF Presentation.pptxMF Presentation.pptx
MF Presentation.pptx
HarshitSingh334328
 
Predicating continuous variables-1.pptx
Predicating continuous  variables-1.pptxPredicating continuous  variables-1.pptx
Predicating continuous variables-1.pptx
luckyanirudhsai
 
Use of Linear Regression in Machine Learning for Ranking
Use of Linear Regression in Machine Learning for RankingUse of Linear Regression in Machine Learning for Ranking
Use of Linear Regression in Machine Learning for Ranking
ijsrd.com
 
Simple Regression.pptx
Simple Regression.pptxSimple Regression.pptx
Simple Regression.pptx
Victoria Bozhenko
 
Multiple-Linear-Regression-Model-Analysis.pptx
Multiple-Linear-Regression-Model-Analysis.pptxMultiple-Linear-Regression-Model-Analysis.pptx
Multiple-Linear-Regression-Model-Analysis.pptx
NaryCasila
 

Similar to Linear Regression (20)

NPTL Machine Learning Week 2.docx
NPTL Machine Learning Week 2.docxNPTL Machine Learning Week 2.docx
NPTL Machine Learning Week 2.docx
 
Unit 03 - Consolidated.pptx
Unit 03 - Consolidated.pptxUnit 03 - Consolidated.pptx
Unit 03 - Consolidated.pptx
 
Supervised Learning.pdf
Supervised Learning.pdfSupervised Learning.pdf
Supervised Learning.pdf
 
linearregression-1909240jhgg53948.pptx
linearregression-1909240jhgg53948.pptxlinearregression-1909240jhgg53948.pptx
linearregression-1909240jhgg53948.pptx
 
working with python
working with pythonworking with python
working with python
 
Bootcamp of new world to taken seriously
Bootcamp of new world to taken seriouslyBootcamp of new world to taken seriously
Bootcamp of new world to taken seriously
 
Simple lin regress_inference
Simple lin regress_inferenceSimple lin regress_inference
Simple lin regress_inference
 
Correlation and regression in r
Correlation and regression in rCorrelation and regression in r
Correlation and regression in r
 
Chapter III.pptx
Chapter III.pptxChapter III.pptx
Chapter III.pptx
 
Linear_Regression
Linear_RegressionLinear_Regression
Linear_Regression
 
Detail Study of the concept of Regression model.pptx
Detail Study of the concept of  Regression model.pptxDetail Study of the concept of  Regression model.pptx
Detail Study of the concept of Regression model.pptx
 
Regression Analysis.pptx
Regression Analysis.pptxRegression Analysis.pptx
Regression Analysis.pptx
 
Regression Analysis Techniques.pptx
Regression Analysis Techniques.pptxRegression Analysis Techniques.pptx
Regression Analysis Techniques.pptx
 
Statistical parameters
Statistical parametersStatistical parameters
Statistical parameters
 
Machine Learning Unit 3 Semester 3 MSc IT Part 2 Mumbai University
Machine Learning Unit 3 Semester 3  MSc IT Part 2 Mumbai UniversityMachine Learning Unit 3 Semester 3  MSc IT Part 2 Mumbai University
Machine Learning Unit 3 Semester 3 MSc IT Part 2 Mumbai University
 
MF Presentation.pptx
MF Presentation.pptxMF Presentation.pptx
MF Presentation.pptx
 
Predicating continuous variables-1.pptx
Predicating continuous  variables-1.pptxPredicating continuous  variables-1.pptx
Predicating continuous variables-1.pptx
 
Use of Linear Regression in Machine Learning for Ranking
Use of Linear Regression in Machine Learning for RankingUse of Linear Regression in Machine Learning for Ranking
Use of Linear Regression in Machine Learning for Ranking
 
Simple Regression.pptx
Simple Regression.pptxSimple Regression.pptx
Simple Regression.pptx
 
Multiple-Linear-Regression-Model-Analysis.pptx
Multiple-Linear-Regression-Model-Analysis.pptxMultiple-Linear-Regression-Model-Analysis.pptx
Multiple-Linear-Regression-Model-Analysis.pptx
 

More from Abdullah al Mamun

Underfitting and Overfitting in Machine Learning
Underfitting and Overfitting in Machine LearningUnderfitting and Overfitting in Machine Learning
Underfitting and Overfitting in Machine Learning
Abdullah al Mamun
 
Recurrent Neural Networks (RNNs)
Recurrent Neural Networks (RNNs)Recurrent Neural Networks (RNNs)
Recurrent Neural Networks (RNNs)
Abdullah al Mamun
 
Random Forest
Random ForestRandom Forest
Random Forest
Abdullah al Mamun
 
Principal Component Analysis PCA
Principal Component Analysis PCAPrincipal Component Analysis PCA
Principal Component Analysis PCA
Abdullah al Mamun
 
Natural Language Processing (NLP)
Natural Language Processing (NLP)Natural Language Processing (NLP)
Natural Language Processing (NLP)
Abdullah al Mamun
 
Naive Bayes
Naive BayesNaive Bayes
Naive Bayes
Abdullah al Mamun
 
Multilayer Perceptron Neural Network MLP
Multilayer Perceptron Neural Network MLPMultilayer Perceptron Neural Network MLP
Multilayer Perceptron Neural Network MLP
Abdullah al Mamun
 
Long Short Term Memory LSTM
Long Short Term Memory LSTMLong Short Term Memory LSTM
Long Short Term Memory LSTM
Abdullah al Mamun
 
K-Nearest Neighbor(KNN)
K-Nearest Neighbor(KNN)K-Nearest Neighbor(KNN)
K-Nearest Neighbor(KNN)
Abdullah al Mamun
 
Hidden Markov Model (HMM)
Hidden Markov Model (HMM)Hidden Markov Model (HMM)
Hidden Markov Model (HMM)
Abdullah al Mamun
 
Ensemble Method (Bagging Boosting)
Ensemble Method (Bagging Boosting)Ensemble Method (Bagging Boosting)
Ensemble Method (Bagging Boosting)
Abdullah al Mamun
 
Convolutional Neural Networks CNN
Convolutional Neural Networks CNNConvolutional Neural Networks CNN
Convolutional Neural Networks CNN
Abdullah al Mamun
 
Artificial Neural Network ANN
Artificial Neural Network ANNArtificial Neural Network ANN
Artificial Neural Network ANN
Abdullah al Mamun
 
Reinforcement Learning, Application and Q-Learning
Reinforcement Learning, Application and Q-LearningReinforcement Learning, Application and Q-Learning
Reinforcement Learning, Application and Q-Learning
Abdullah al Mamun
 
Session on evaluation of DevSecOps
Session on evaluation of DevSecOpsSession on evaluation of DevSecOps
Session on evaluation of DevSecOps
Abdullah al Mamun
 
Artificial Intelligence: Classification, Applications, Opportunities, and Cha...
Artificial Intelligence: Classification, Applications, Opportunities, and Cha...Artificial Intelligence: Classification, Applications, Opportunities, and Cha...
Artificial Intelligence: Classification, Applications, Opportunities, and Cha...
Abdullah al Mamun
 
DevOps Presentation.pptx
DevOps Presentation.pptxDevOps Presentation.pptx
DevOps Presentation.pptx
Abdullah al Mamun
 
Python Virtual Environment.pptx
Python Virtual Environment.pptxPython Virtual Environment.pptx
Python Virtual Environment.pptx
Abdullah al Mamun
 
Artificial intelligence Presentation.pptx
Artificial intelligence Presentation.pptxArtificial intelligence Presentation.pptx
Artificial intelligence Presentation.pptx
Abdullah al Mamun
 
An approach to empirical Optical Character recognition paradigm using Multi-L...
An approach to empirical Optical Character recognition paradigm using Multi-L...An approach to empirical Optical Character recognition paradigm using Multi-L...
An approach to empirical Optical Character recognition paradigm using Multi-L...
Abdullah al Mamun
 

More from Abdullah al Mamun (20)

Underfitting and Overfitting in Machine Learning
Underfitting and Overfitting in Machine LearningUnderfitting and Overfitting in Machine Learning
Underfitting and Overfitting in Machine Learning
 
Recurrent Neural Networks (RNNs)
Recurrent Neural Networks (RNNs)Recurrent Neural Networks (RNNs)
Recurrent Neural Networks (RNNs)
 
Random Forest
Random ForestRandom Forest
Random Forest
 
Principal Component Analysis PCA
Principal Component Analysis PCAPrincipal Component Analysis PCA
Principal Component Analysis PCA
 
Natural Language Processing (NLP)
Natural Language Processing (NLP)Natural Language Processing (NLP)
Natural Language Processing (NLP)
 
Naive Bayes
Naive BayesNaive Bayes
Naive Bayes
 
Multilayer Perceptron Neural Network MLP
Multilayer Perceptron Neural Network MLPMultilayer Perceptron Neural Network MLP
Multilayer Perceptron Neural Network MLP
 
Long Short Term Memory LSTM
Long Short Term Memory LSTMLong Short Term Memory LSTM
Long Short Term Memory LSTM
 
K-Nearest Neighbor(KNN)
K-Nearest Neighbor(KNN)K-Nearest Neighbor(KNN)
K-Nearest Neighbor(KNN)
 
Hidden Markov Model (HMM)
Hidden Markov Model (HMM)Hidden Markov Model (HMM)
Hidden Markov Model (HMM)
 
Ensemble Method (Bagging Boosting)
Ensemble Method (Bagging Boosting)Ensemble Method (Bagging Boosting)
Ensemble Method (Bagging Boosting)
 
Convolutional Neural Networks CNN
Convolutional Neural Networks CNNConvolutional Neural Networks CNN
Convolutional Neural Networks CNN
 
Artificial Neural Network ANN
Artificial Neural Network ANNArtificial Neural Network ANN
Artificial Neural Network ANN
 
Reinforcement Learning, Application and Q-Learning
Reinforcement Learning, Application and Q-LearningReinforcement Learning, Application and Q-Learning
Reinforcement Learning, Application and Q-Learning
 
Session on evaluation of DevSecOps
Session on evaluation of DevSecOpsSession on evaluation of DevSecOps
Session on evaluation of DevSecOps
 
Artificial Intelligence: Classification, Applications, Opportunities, and Cha...
Artificial Intelligence: Classification, Applications, Opportunities, and Cha...Artificial Intelligence: Classification, Applications, Opportunities, and Cha...
Artificial Intelligence: Classification, Applications, Opportunities, and Cha...
 
DevOps Presentation.pptx
DevOps Presentation.pptxDevOps Presentation.pptx
DevOps Presentation.pptx
 
Python Virtual Environment.pptx
Python Virtual Environment.pptxPython Virtual Environment.pptx
Python Virtual Environment.pptx
 
Artificial intelligence Presentation.pptx
Artificial intelligence Presentation.pptxArtificial intelligence Presentation.pptx
Artificial intelligence Presentation.pptx
 
An approach to empirical Optical Character recognition paradigm using Multi-L...
An approach to empirical Optical Character recognition paradigm using Multi-L...An approach to empirical Optical Character recognition paradigm using Multi-L...
An approach to empirical Optical Character recognition paradigm using Multi-L...
 

Recently uploaded

一比一原版(Adelaide毕业证书)阿德莱德大学毕业证如何办理
一比一原版(Adelaide毕业证书)阿德莱德大学毕业证如何办理一比一原版(Adelaide毕业证书)阿德莱德大学毕业证如何办理
一比一原版(Adelaide毕业证书)阿德莱德大学毕业证如何办理
slg6lamcq
 
一比一原版(UIUC毕业证)伊利诺伊大学|厄巴纳-香槟分校毕业证如何办理
一比一原版(UIUC毕业证)伊利诺伊大学|厄巴纳-香槟分校毕业证如何办理一比一原版(UIUC毕业证)伊利诺伊大学|厄巴纳-香槟分校毕业证如何办理
一比一原版(UIUC毕业证)伊利诺伊大学|厄巴纳-香槟分校毕业证如何办理
ahzuo
 
一比一原版(CBU毕业证)卡普顿大学毕业证成绩单
一比一原版(CBU毕业证)卡普顿大学毕业证成绩单一比一原版(CBU毕业证)卡普顿大学毕业证成绩单
一比一原版(CBU毕业证)卡普顿大学毕业证成绩单
nscud
 
一比一原版(UPenn毕业证)宾夕法尼亚大学毕业证成绩单
一比一原版(UPenn毕业证)宾夕法尼亚大学毕业证成绩单一比一原版(UPenn毕业证)宾夕法尼亚大学毕业证成绩单
一比一原版(UPenn毕业证)宾夕法尼亚大学毕业证成绩单
ewymefz
 
一比一原版(QU毕业证)皇后大学毕业证成绩单
一比一原版(QU毕业证)皇后大学毕业证成绩单一比一原版(QU毕业证)皇后大学毕业证成绩单
一比一原版(QU毕业证)皇后大学毕业证成绩单
enxupq
 
一比一原版(RUG毕业证)格罗宁根大学毕业证成绩单
一比一原版(RUG毕业证)格罗宁根大学毕业证成绩单一比一原版(RUG毕业证)格罗宁根大学毕业证成绩单
一比一原版(RUG毕业证)格罗宁根大学毕业证成绩单
vcaxypu
 
SOCRadar Germany 2024 Threat Landscape Report
SOCRadar Germany 2024 Threat Landscape ReportSOCRadar Germany 2024 Threat Landscape Report
SOCRadar Germany 2024 Threat Landscape Report
SOCRadar
 
一比一原版(NYU毕业证)纽约大学毕业证成绩单
一比一原版(NYU毕业证)纽约大学毕业证成绩单一比一原版(NYU毕业证)纽约大学毕业证成绩单
一比一原版(NYU毕业证)纽约大学毕业证成绩单
ewymefz
 
一比一原版(CU毕业证)卡尔顿大学毕业证成绩单
一比一原版(CU毕业证)卡尔顿大学毕业证成绩单一比一原版(CU毕业证)卡尔顿大学毕业证成绩单
一比一原版(CU毕业证)卡尔顿大学毕业证成绩单
yhkoc
 
一比一原版(TWU毕业证)西三一大学毕业证成绩单
一比一原版(TWU毕业证)西三一大学毕业证成绩单一比一原版(TWU毕业证)西三一大学毕业证成绩单
一比一原版(TWU毕业证)西三一大学毕业证成绩单
ocavb
 
一比一原版(CBU毕业证)不列颠海角大学毕业证成绩单
一比一原版(CBU毕业证)不列颠海角大学毕业证成绩单一比一原版(CBU毕业证)不列颠海角大学毕业证成绩单
一比一原版(CBU毕业证)不列颠海角大学毕业证成绩单
nscud
 
Algorithmic optimizations for Dynamic Levelwise PageRank (from STICD) : SHORT...
Algorithmic optimizations for Dynamic Levelwise PageRank (from STICD) : SHORT...Algorithmic optimizations for Dynamic Levelwise PageRank (from STICD) : SHORT...
Algorithmic optimizations for Dynamic Levelwise PageRank (from STICD) : SHORT...
Subhajit Sahu
 
哪里卖(usq毕业证书)南昆士兰大学毕业证研究生文凭证书托福证书原版一模一样
哪里卖(usq毕业证书)南昆士兰大学毕业证研究生文凭证书托福证书原版一模一样哪里卖(usq毕业证书)南昆士兰大学毕业证研究生文凭证书托福证书原版一模一样
哪里卖(usq毕业证书)南昆士兰大学毕业证研究生文凭证书托福证书原版一模一样
axoqas
 
Chatty Kathy - UNC Bootcamp Final Project Presentation - Final Version - 5.23...
Chatty Kathy - UNC Bootcamp Final Project Presentation - Final Version - 5.23...Chatty Kathy - UNC Bootcamp Final Project Presentation - Final Version - 5.23...
Chatty Kathy - UNC Bootcamp Final Project Presentation - Final Version - 5.23...
John Andrews
 
一比一原版(YU毕业证)约克大学毕业证成绩单
一比一原版(YU毕业证)约克大学毕业证成绩单一比一原版(YU毕业证)约克大学毕业证成绩单
一比一原版(YU毕业证)约克大学毕业证成绩单
enxupq
 
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单
ewymefz
 
Adjusting primitives for graph : SHORT REPORT / NOTES
Adjusting primitives for graph : SHORT REPORT / NOTESAdjusting primitives for graph : SHORT REPORT / NOTES
Adjusting primitives for graph : SHORT REPORT / NOTES
Subhajit Sahu
 
Machine learning and optimization techniques for electrical drives.pptx
Machine learning and optimization techniques for electrical drives.pptxMachine learning and optimization techniques for electrical drives.pptx
Machine learning and optimization techniques for electrical drives.pptx
balafet
 
一比一原版(UofM毕业证)明尼苏达大学毕业证成绩单
一比一原版(UofM毕业证)明尼苏达大学毕业证成绩单一比一原版(UofM毕业证)明尼苏达大学毕业证成绩单
一比一原版(UofM毕业证)明尼苏达大学毕业证成绩单
ewymefz
 
一比一原版(CBU毕业证)卡普顿大学毕业证如何办理
一比一原版(CBU毕业证)卡普顿大学毕业证如何办理一比一原版(CBU毕业证)卡普顿大学毕业证如何办理
一比一原版(CBU毕业证)卡普顿大学毕业证如何办理
ahzuo
 

Recently uploaded (20)

一比一原版(Adelaide毕业证书)阿德莱德大学毕业证如何办理
一比一原版(Adelaide毕业证书)阿德莱德大学毕业证如何办理一比一原版(Adelaide毕业证书)阿德莱德大学毕业证如何办理
一比一原版(Adelaide毕业证书)阿德莱德大学毕业证如何办理
 
一比一原版(UIUC毕业证)伊利诺伊大学|厄巴纳-香槟分校毕业证如何办理
一比一原版(UIUC毕业证)伊利诺伊大学|厄巴纳-香槟分校毕业证如何办理一比一原版(UIUC毕业证)伊利诺伊大学|厄巴纳-香槟分校毕业证如何办理
一比一原版(UIUC毕业证)伊利诺伊大学|厄巴纳-香槟分校毕业证如何办理
 
一比一原版(CBU毕业证)卡普顿大学毕业证成绩单
一比一原版(CBU毕业证)卡普顿大学毕业证成绩单一比一原版(CBU毕业证)卡普顿大学毕业证成绩单
一比一原版(CBU毕业证)卡普顿大学毕业证成绩单
 
一比一原版(UPenn毕业证)宾夕法尼亚大学毕业证成绩单
一比一原版(UPenn毕业证)宾夕法尼亚大学毕业证成绩单一比一原版(UPenn毕业证)宾夕法尼亚大学毕业证成绩单
一比一原版(UPenn毕业证)宾夕法尼亚大学毕业证成绩单
 
一比一原版(QU毕业证)皇后大学毕业证成绩单
一比一原版(QU毕业证)皇后大学毕业证成绩单一比一原版(QU毕业证)皇后大学毕业证成绩单
一比一原版(QU毕业证)皇后大学毕业证成绩单
 
一比一原版(RUG毕业证)格罗宁根大学毕业证成绩单
一比一原版(RUG毕业证)格罗宁根大学毕业证成绩单一比一原版(RUG毕业证)格罗宁根大学毕业证成绩单
一比一原版(RUG毕业证)格罗宁根大学毕业证成绩单
 
SOCRadar Germany 2024 Threat Landscape Report
SOCRadar Germany 2024 Threat Landscape ReportSOCRadar Germany 2024 Threat Landscape Report
SOCRadar Germany 2024 Threat Landscape Report
 
一比一原版(NYU毕业证)纽约大学毕业证成绩单
一比一原版(NYU毕业证)纽约大学毕业证成绩单一比一原版(NYU毕业证)纽约大学毕业证成绩单
一比一原版(NYU毕业证)纽约大学毕业证成绩单
 
一比一原版(CU毕业证)卡尔顿大学毕业证成绩单
一比一原版(CU毕业证)卡尔顿大学毕业证成绩单一比一原版(CU毕业证)卡尔顿大学毕业证成绩单
一比一原版(CU毕业证)卡尔顿大学毕业证成绩单
 
一比一原版(TWU毕业证)西三一大学毕业证成绩单
一比一原版(TWU毕业证)西三一大学毕业证成绩单一比一原版(TWU毕业证)西三一大学毕业证成绩单
一比一原版(TWU毕业证)西三一大学毕业证成绩单
 
一比一原版(CBU毕业证)不列颠海角大学毕业证成绩单
一比一原版(CBU毕业证)不列颠海角大学毕业证成绩单一比一原版(CBU毕业证)不列颠海角大学毕业证成绩单
一比一原版(CBU毕业证)不列颠海角大学毕业证成绩单
 
Algorithmic optimizations for Dynamic Levelwise PageRank (from STICD) : SHORT...
Algorithmic optimizations for Dynamic Levelwise PageRank (from STICD) : SHORT...Algorithmic optimizations for Dynamic Levelwise PageRank (from STICD) : SHORT...
Algorithmic optimizations for Dynamic Levelwise PageRank (from STICD) : SHORT...
 
哪里卖(usq毕业证书)南昆士兰大学毕业证研究生文凭证书托福证书原版一模一样
哪里卖(usq毕业证书)南昆士兰大学毕业证研究生文凭证书托福证书原版一模一样哪里卖(usq毕业证书)南昆士兰大学毕业证研究生文凭证书托福证书原版一模一样
哪里卖(usq毕业证书)南昆士兰大学毕业证研究生文凭证书托福证书原版一模一样
 
Chatty Kathy - UNC Bootcamp Final Project Presentation - Final Version - 5.23...
Chatty Kathy - UNC Bootcamp Final Project Presentation - Final Version - 5.23...Chatty Kathy - UNC Bootcamp Final Project Presentation - Final Version - 5.23...
Chatty Kathy - UNC Bootcamp Final Project Presentation - Final Version - 5.23...
 
一比一原版(YU毕业证)约克大学毕业证成绩单
一比一原版(YU毕业证)约克大学毕业证成绩单一比一原版(YU毕业证)约克大学毕业证成绩单
一比一原版(YU毕业证)约克大学毕业证成绩单
 
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单
 
Adjusting primitives for graph : SHORT REPORT / NOTES
Adjusting primitives for graph : SHORT REPORT / NOTESAdjusting primitives for graph : SHORT REPORT / NOTES
Adjusting primitives for graph : SHORT REPORT / NOTES
 
Machine learning and optimization techniques for electrical drives.pptx
Machine learning and optimization techniques for electrical drives.pptxMachine learning and optimization techniques for electrical drives.pptx
Machine learning and optimization techniques for electrical drives.pptx
 
一比一原版(UofM毕业证)明尼苏达大学毕业证成绩单
一比一原版(UofM毕业证)明尼苏达大学毕业证成绩单一比一原版(UofM毕业证)明尼苏达大学毕业证成绩单
一比一原版(UofM毕业证)明尼苏达大学毕业证成绩单
 
一比一原版(CBU毕业证)卡普顿大学毕业证如何办理
一比一原版(CBU毕业证)卡普顿大学毕业证如何办理一比一原版(CBU毕业证)卡普顿大学毕业证如何办理
一比一原版(CBU毕业证)卡普顿大学毕业证如何办理
 

Linear Regression

  • 2. What is Regression? Regression is a supervised learning technique which helps in finding the correlation between variables and enables us to predict the continuous output variable based on the one or more predictor variables. It is mainly used for prediction, forecasting, time series modeling, and determining the causal-effect relationship between variables. Regression analysis helps in the prediction of a continuous variable.
  • 4. What is Linear Regression? ❏ Linear regression analysis is used to predict the value of a variable based on the value of another variable ❏ 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.
  • 5. Types of linear regression ❏ Simple linear regression : The goal of a simple linear regression is to predict the value of a dependent variable based on an independent variable. Simple linear regression is used to model the relationship between two continuous variables. Often, the objective is to predict the value of an output variable (or response) based on the value of an input (or predictor) variable. ❏ Multiple linear regression: Multiple linear regression is used to estimate the relationship between two or more independent variables and one dependent variable.
  • 6. Types of linear regression
  • 7. Equation of Simple linear regression Y= mX+b ❏ Y represents the dependent variable ❏ X represents the independent variable ❏ m is the slope of the line( how much Y changes for a unit change in X) ❏ b is the intercept ( the value of Y when X is 0)
  • 8. Example : Predicting Pizza Prices Diameter (X) in Inches Price(Y) in Dollars 8 10 10 13 12 16 What will be the 20-inch pizza price?
  • 9. Example : Predicting Pizza Prices m= sum of product of deviations / sum of square of deviation for x = 12/8 = 1.5 b= Mean of Y - (m* Mean of X) = 13 - (1.5*10) = -2 Y= mX+b = 1.5X- 2 = 1.5*20-2 = 28 Dollar
  • 11. Example of Multiple Linear Regression Here, the Matrices for Y and X are given as follows
  • 12. Example of Multiple Linear Regression The Coefficient of the Multiple Regression Equation is given as
  • 13. Example of Multiple Linear Regression
  • 14. Example of Multiple Linear Regression
  • 15. Cost Function in Linear Regression For the Linear regression model, the cost function will be the minimum of the Root Mean Squared Error of the model, obtained by subtracting the predicted values from actual values. It is a numeric value that indicates the success or failure of a particular model without needing to understand the inner workings of a model.
  • 16. Why is the cost function needed? Basically, our machine learning model predicts the new value. We aim to have the predicted value as close as possible to the predicted value. If the model predicts the value close to the actual value, then we will say it’s a good model. So here is where cost function plays an important role. This cost function is needed to calculate the difference between actual and predicted values. So here it is nothing, just the difference between the actual values-predicted values.
  • 17. Types of Cost Function in Linear Regression Mean error: These errors can be negative or positive. Therefore, they can cancel each other out during the summation, and the average error of the model will be zero. Mean Squared Error : MSE represents the average squared difference between the predictions and expected results. I = index of sample Ŷ = predicted value Y = expected value M = number of samples in the data set
  • 18. Types of Cost Function in Linear Regression Mean Absolute Error: MSE is a variation of MAE that squares the difference instead of taking the absolute value of the difference. There is no possibility of negative errors. I = index of sample Ŷ = predicted value Y = expected value M = number of samples in the data set
  • 19. Types of Cost Function in Linear Regression Root mean squared error (RMSE): The Root Mean Squared Error (RMSE) is one of the two main performance indicators for a regression model. It measures the average difference between values predicted by a model and the actual values.
  • 20. Exploring the Cost Function We have a training set with three points (1, 1), (2, 2), and (3, 3). We plot the function f(x) = w * x for different values of w and calculate the corresponding cost function J(w). When w = 1: f(x) = x, the line passes through the origin, perfectly fitting the data. The cost function J(w) is 0 since f(x) equals y for all training examples. Setting w = 0.5: f(x) = 0.5 * x, the line has a smaller slope. The cost function J(w) now measures the squared errors between f(x) and y for each example. It provides a measure of how well the line fits the data. Function f(x) vs. Cost Function J(w)
  • 21. Real-life example of cost function Here, y denotes the target variable(Price of House), X denotes the size of the House and a0 is the intercept. The linear regression model will fit a straight line to our data, as shown in fig, and it will tell us what is the price of the House when we know the size of the House. Suppose this housing company sells houses having areas under 600 to 1500 square feet. So the prices will vary according to the size of the plot. For example House(1200 to 1500 square feet)= 65 lakhs. Now suddenly, there’s a rise in demand of Houses which means the price of this House will increase now. Suppose the price has now increased to 75 lakhs. But what if the model predicted its price as 30 lakhs? So this difference between these actual and predicted values is calculated by the cost function.
  • 22. Applications of Linear Regression ❏ Market analysis ❏ Financial analysis ❏ Sports analysis ❏ Environmental health ❏ Medicine
  • 23. Advantages of Linear Regression ❏ Linear Regression is simple to implement and easier to interpret the output coefficients ❏ When you know the relationship between the independent and dependent variable have a linear relationship, this algorithm is the best to use because of it’s less complexity compared to other algorithms. ❏ Linear Regression is susceptible to over-fitting but it can be avoided using some dimensionality reduction techniques, regularization (L1 and L2) techniques and cross-validation.
  • 24. Drawbacks of Linear Regression ❏ Linear Assumption ❏ Sensitivity to Exceptions ❏ Independence Presumption ❏ Limited to Linear Relationships
  • 25. Conclusion Linear regression is a foundational and widely used technique in machine learning, offering a straightforward yet effective way to model relationships between variables. It is a valuable tool for making predictions and understanding data patterns, though its suitability depends on the specific problem and the linearity assumption. While it may not always be the best choice, it remains an essential component of the machine learning toolkit, providing valuable insights in various domains.
  • 26. References ❖ https://www.geeksforgeeks.org/ml-advantages-and-disadvantages-of-linear- regression/ ❖ https://iq.opengenus.org/advantages-and-disadvantages-of-linear-regression/ ❖ https://www.intellspot.com/linear-regression-examples/ ❖ https://www.tutorialspoint.com/advantages-and-disadvantages-of-linear- regression#:~:text=The%20strategy%20is%20simple%20to,the%20subordinate%20and %20free%20factors. ❖ https://sphweb.bumc.bu.edu/otlt/MPH-Modules/BS/BS704- EP713_MultivariableMethods/ ❖ https://www.javatpoint.com/simple-linear-regression-in-machine-learning ❖ https://youtu.be/zUQr6HAAKp4?si=V-ojf6pXnMO2p7DR ❖ https://youtu.be/lzGKRSvs5HM?si=RduTOfWWjb05n5tF ❖ https://www.shiksha.com/online-courses/articles/cost-function-in-machine- learning/#Why-is-the-cost-function-needed? ❖ https://medium.com/@yennhi95zz/3-understanding-the-cost-function-in-linear-regression-for- machine-learning-beginners-ec9edeecbdde ❖ https://datatab.net/tutorial/linear-regression ❖ https://www.youtube.com/watch?v=QcPycBZomac