Lecture 4 - Linear Regression, a lecture in subject module Statistical & Mach...Maninda Edirisooriya
Simplest Machine Learning algorithm or one of the most fundamental Statistical Learning technique is Linear Regression. This was one of the lectures of a full course I taught in University of Moratuwa, Sri Lanka on 2023 second half of the year.
Linear regression is a popular machine learning algorithm that models the linear relationship between a dependent variable and one or more independent variables. Simple linear regression uses one independent variable, while multiple linear regression uses more than one. The linear regression model finds coefficients that help predict the dependent variable based on the independent variables. The model performance is evaluated using metrics like the coefficient of determination (R-squared). Linear regression makes assumptions such as a linear relationship between variables and normally distributed errors.
Linear regression is a popular machine learning algorithm that models the linear relationship between a dependent variable and one or more independent variables. Simple linear regression uses one independent variable, while multiple linear regression uses more than one. The linear regression model finds coefficients that help predict the dependent variable based on the independent variables. The model performance is evaluated using metrics like the coefficient of determination (R-squared). Linear regression makes assumptions such as a linear relationship between variables and normally distributed errors.
Regression analysis is a statistical technique used to model relationships between variables. Simple regression uses one independent variable to predict a dependent variable, while multiple regression uses two or more independent variables. Both aim to find the coefficients that minimize prediction error by fitting linear equations to data. Ordinary least squares estimation determines the optimal slope and intercept coefficients by minimizing the sum of squared errors between predicted and actual values.
This document discusses multiple regression analysis techniques. It begins by stating the goals of developing a statistical model to predict dependent variables from independent variables and using multiple regression when more than one independent variable is useful for prediction. It then provides an introduction to simple and multiple regression. The rest of the document discusses key aspects of multiple regression analysis, including linear models, the method of least squares, standard error of estimate, coefficient of multiple determination, hypothesis testing, and selection of predictor variables.
This document provides an overview of simple linear regression analysis. It discusses estimating regression coefficients using the least squares method, interpreting the regression equation, assessing model fit using measures like the standard error of the estimate and coefficient of determination, testing hypotheses about regression coefficients, and using the regression model to make predictions.
Unit-III Correlation and Regression.pptxAnusuya123
Unit-III describes different types of relationships between variables through correlation and regression analysis. It discusses:
1) Correlation measures the strength and direction of a linear relationship between two variables on a scatter plot. Positive correlation means variables increase together, while negative correlation means one increases as the other decreases.
2) Regression analysis uses independent variables to predict outcomes of a dependent variable. A regression line minimizes the squared errors between predicted and actual values.
3) The correlation coefficient r and coefficient of determination r-squared quantify the strength and direction of linear relationships, with values between -1 and 1. Extreme scores on one measurement tend to regress toward the mean on subsequent measurements.
This document provides an overview of simple and multiple linear regression analysis. It discusses key concepts such as:
- Dependent and independent variables in bivariate linear regression
- Using scatter plots to explore relationships
- Estimating regression coefficients and equations for simple and multiple regression models
- Using regression models to predict outcomes based on independent variable values
- Conducting statistical tests on overall regression models and individual coefficients
- Regression analysis is used to study the relationship between variables and predict how the value of one variable changes with the other. It is one of the most commonly used tools for business analysis.
- Simple linear regression analyzes the relationship between one independent variable and one dependent variable. The regression equation estimates the dependent variable as a linear function of the independent variable.
- Least squares regression fits a line to the data by minimizing the sum of the squared residuals, providing estimates of the slope and y-intercept coefficients in the regression equation.
This document provides an overview of regression analysis and compares regression to neural networks. It defines regression as estimating the relationship between variables. The main types covered are linear, nonlinear, simple, multiple and logistic regression. Examples are given to illustrate simple linear regression and least squares methods. The document also discusses best practices like avoiding overfitting and dealing with multicollinearity. Finally, it provides examples comparing regression and deep learning approaches.
This document provides an overview of simple linear regression. It defines regression as measuring the average relationship between two variables. Simple linear regression finds the linear relationship between a dependent variable (y) and independent variable (x) using a regression equation of the form y = a + bx. It describes calculating the intercept (a) and slope (b) using the least squares method. An example demonstrates predicting y values from x using the regression equation. Residuals represent prediction errors and a residual plot can show if the regression model fits the data well with no obvious patterns.
This document provides an overview of simple linear regression. It defines regression as measuring the average relationship between two variables. Regression allows estimation and prediction of a dependent variable from an independent variable. The key aspects covered include the linear regression equation Y = a + bX, where a is the Y-intercept and b is the slope. Residuals, which represent prediction errors, are also discussed. A residual plot is used to evaluate the appropriateness of the regression model by examining patterns in the residuals.
The document provides an overview of regression analysis. It defines regression analysis as a technique used to estimate the relationship between a dependent variable and one or more independent variables. The key purposes of regression are to estimate relationships between variables, determine the effect of each independent variable on the dependent variable, and predict the dependent variable given values of the independent variables. The document also outlines the assumptions of the linear regression model, introduces simple and multiple regression, and describes methods for model building including variable selection procedures.
linear regression is a linear approach for modelling a predictive relationship between a scalar response and one or more explanatory variables (also known as dependent and independent variables), which are measured without error. The case of one explanatory variable is called simple linear regression; for more than one, the process is called multiple linear regression. This term is distinct from multivariate linear regression, where multiple correlated dependent variables are predicted, rather than a single scalar variable. If the explanatory variables are measured with error then errors-in-variables models are required, also known as measurement error models.
In linear regression, the relationships are modeled using linear predictor functions whose unknown model parameters are estimated from the data. Such models are called linear models. Most commonly, the conditional mean of the response given the values of the explanatory variables (or predictors) is assumed to be an affine function of those values; less commonly, the conditional median or some other quantile is used. Like all forms of regression analysis, linear regression focuses on the conditional probability distribution of the response given the values of the predictors, rather than on the joint probability distribution of all of these variables, which is the domain of multivariate analysis.
Linear regression was the first type of regression analysis to be studied rigorously, and to be used extensively in practical applications.[4] This is because models which depend linearly on their unknown parameters are easier to fit than models which are non-linearly related to their parameters and because the statistical properties of the resulting estimators are easier to determine.
Linear regression has many practical uses. Most applications fall into one of the following two broad categories:
If the goal is error reduction in prediction or forecasting, linear regression can be used to fit a predictive model to an observed data set of values of the response and explanatory variables. After developing such a model, if additional values of the explanatory variables are collected without an accompanying response value, the fitted model can be used to make a prediction of the response.
If the goal is to explain variation in the response variable that can be attributed to variation in the explanatory variables, linear regression analysis can be applied to quantify the strength of the relationship between the response and the explanatory variables, and in particular to determine whether some explanatory variables may have no linear relationship with the response at all, or to identify which subsets of explanatory variables may contain redundant information about the response.
Regression Analysis is simplified in this presentation. Starting with simple linear to multiple regression analysis, it covers all the statistics and interpretation of various diagnostic plots. Besides, how to verify regression assumptions and some advance concepts of choosing best models makes the slides more useful SAS program codes of two examples are also included.
Description:
This presentation explores various types of storage devices and explains how data is stored and retrieved in audio and visual formats. It covers the classification of storage devices, their roles in data handling, and the basic mechanisms involved in storing multimedia content. The slides are designed for educational use, making them valuable for students, teachers, and beginners in the field of computer science and digital media.
About the Author & Designer
Noor Zulfiqar is a professional scientific writer, researcher, and certified presentation designer with expertise in natural sciences, and other interdisciplinary fields. She is known for creating high-quality academic content and visually engaging presentations tailored for researchers, students, and professionals worldwide. With an excellent academic record, she has authored multiple research publications in reputed international journals and is a member of the American Chemical Society (ACS). Noor is also a certified peer reviewer, recognized for her insightful evaluations of scientific manuscripts across diverse disciplines. Her work reflects a commitment to academic excellence, innovation, and clarity whether through research articles or visually impactful presentations.
For collaborations or custom-designed presentations, contact:
Email: [email protected]
Facebook Page: facebook.com/ResearchWriter94
Website: https://professional-content-writings.jimdosite.com
Dr. Robert Krug - Expert In Artificial IntelligenceDr. Robert Krug
Dr. Robert Krug is a New York-based expert in artificial intelligence, with a Ph.D. in Computer Science from Columbia University. He serves as Chief Data Scientist at DataInnovate Solutions, where his work focuses on applying machine learning models to improve business performance and strengthen cybersecurity measures. With over 15 years of experience, Robert has a track record of delivering impactful results. Away from his professional endeavors, Robert enjoys the strategic thinking of chess and urban photography.
Ad
More Related Content
Similar to regression analysis presentation slides. (20)
This document provides an overview of simple linear regression analysis. It discusses estimating regression coefficients using the least squares method, interpreting the regression equation, assessing model fit using measures like the standard error of the estimate and coefficient of determination, testing hypotheses about regression coefficients, and using the regression model to make predictions.
Unit-III Correlation and Regression.pptxAnusuya123
Unit-III describes different types of relationships between variables through correlation and regression analysis. It discusses:
1) Correlation measures the strength and direction of a linear relationship between two variables on a scatter plot. Positive correlation means variables increase together, while negative correlation means one increases as the other decreases.
2) Regression analysis uses independent variables to predict outcomes of a dependent variable. A regression line minimizes the squared errors between predicted and actual values.
3) The correlation coefficient r and coefficient of determination r-squared quantify the strength and direction of linear relationships, with values between -1 and 1. Extreme scores on one measurement tend to regress toward the mean on subsequent measurements.
This document provides an overview of simple and multiple linear regression analysis. It discusses key concepts such as:
- Dependent and independent variables in bivariate linear regression
- Using scatter plots to explore relationships
- Estimating regression coefficients and equations for simple and multiple regression models
- Using regression models to predict outcomes based on independent variable values
- Conducting statistical tests on overall regression models and individual coefficients
- Regression analysis is used to study the relationship between variables and predict how the value of one variable changes with the other. It is one of the most commonly used tools for business analysis.
- Simple linear regression analyzes the relationship between one independent variable and one dependent variable. The regression equation estimates the dependent variable as a linear function of the independent variable.
- Least squares regression fits a line to the data by minimizing the sum of the squared residuals, providing estimates of the slope and y-intercept coefficients in the regression equation.
This document provides an overview of regression analysis and compares regression to neural networks. It defines regression as estimating the relationship between variables. The main types covered are linear, nonlinear, simple, multiple and logistic regression. Examples are given to illustrate simple linear regression and least squares methods. The document also discusses best practices like avoiding overfitting and dealing with multicollinearity. Finally, it provides examples comparing regression and deep learning approaches.
This document provides an overview of simple linear regression. It defines regression as measuring the average relationship between two variables. Simple linear regression finds the linear relationship between a dependent variable (y) and independent variable (x) using a regression equation of the form y = a + bx. It describes calculating the intercept (a) and slope (b) using the least squares method. An example demonstrates predicting y values from x using the regression equation. Residuals represent prediction errors and a residual plot can show if the regression model fits the data well with no obvious patterns.
This document provides an overview of simple linear regression. It defines regression as measuring the average relationship between two variables. Regression allows estimation and prediction of a dependent variable from an independent variable. The key aspects covered include the linear regression equation Y = a + bX, where a is the Y-intercept and b is the slope. Residuals, which represent prediction errors, are also discussed. A residual plot is used to evaluate the appropriateness of the regression model by examining patterns in the residuals.
The document provides an overview of regression analysis. It defines regression analysis as a technique used to estimate the relationship between a dependent variable and one or more independent variables. The key purposes of regression are to estimate relationships between variables, determine the effect of each independent variable on the dependent variable, and predict the dependent variable given values of the independent variables. The document also outlines the assumptions of the linear regression model, introduces simple and multiple regression, and describes methods for model building including variable selection procedures.
linear regression is a linear approach for modelling a predictive relationship between a scalar response and one or more explanatory variables (also known as dependent and independent variables), which are measured without error. The case of one explanatory variable is called simple linear regression; for more than one, the process is called multiple linear regression. This term is distinct from multivariate linear regression, where multiple correlated dependent variables are predicted, rather than a single scalar variable. If the explanatory variables are measured with error then errors-in-variables models are required, also known as measurement error models.
In linear regression, the relationships are modeled using linear predictor functions whose unknown model parameters are estimated from the data. Such models are called linear models. Most commonly, the conditional mean of the response given the values of the explanatory variables (or predictors) is assumed to be an affine function of those values; less commonly, the conditional median or some other quantile is used. Like all forms of regression analysis, linear regression focuses on the conditional probability distribution of the response given the values of the predictors, rather than on the joint probability distribution of all of these variables, which is the domain of multivariate analysis.
Linear regression was the first type of regression analysis to be studied rigorously, and to be used extensively in practical applications.[4] This is because models which depend linearly on their unknown parameters are easier to fit than models which are non-linearly related to their parameters and because the statistical properties of the resulting estimators are easier to determine.
Linear regression has many practical uses. Most applications fall into one of the following two broad categories:
If the goal is error reduction in prediction or forecasting, linear regression can be used to fit a predictive model to an observed data set of values of the response and explanatory variables. After developing such a model, if additional values of the explanatory variables are collected without an accompanying response value, the fitted model can be used to make a prediction of the response.
If the goal is to explain variation in the response variable that can be attributed to variation in the explanatory variables, linear regression analysis can be applied to quantify the strength of the relationship between the response and the explanatory variables, and in particular to determine whether some explanatory variables may have no linear relationship with the response at all, or to identify which subsets of explanatory variables may contain redundant information about the response.
Regression Analysis is simplified in this presentation. Starting with simple linear to multiple regression analysis, it covers all the statistics and interpretation of various diagnostic plots. Besides, how to verify regression assumptions and some advance concepts of choosing best models makes the slides more useful SAS program codes of two examples are also included.
Description:
This presentation explores various types of storage devices and explains how data is stored and retrieved in audio and visual formats. It covers the classification of storage devices, their roles in data handling, and the basic mechanisms involved in storing multimedia content. The slides are designed for educational use, making them valuable for students, teachers, and beginners in the field of computer science and digital media.
About the Author & Designer
Noor Zulfiqar is a professional scientific writer, researcher, and certified presentation designer with expertise in natural sciences, and other interdisciplinary fields. She is known for creating high-quality academic content and visually engaging presentations tailored for researchers, students, and professionals worldwide. With an excellent academic record, she has authored multiple research publications in reputed international journals and is a member of the American Chemical Society (ACS). Noor is also a certified peer reviewer, recognized for her insightful evaluations of scientific manuscripts across diverse disciplines. Her work reflects a commitment to academic excellence, innovation, and clarity whether through research articles or visually impactful presentations.
For collaborations or custom-designed presentations, contact:
Email: [email protected]
Facebook Page: facebook.com/ResearchWriter94
Website: https://professional-content-writings.jimdosite.com
Dr. Robert Krug - Expert In Artificial IntelligenceDr. Robert Krug
Dr. Robert Krug is a New York-based expert in artificial intelligence, with a Ph.D. in Computer Science from Columbia University. He serves as Chief Data Scientist at DataInnovate Solutions, where his work focuses on applying machine learning models to improve business performance and strengthen cybersecurity measures. With over 15 years of experience, Robert has a track record of delivering impactful results. Away from his professional endeavors, Robert enjoys the strategic thinking of chess and urban photography.
Carbon Nanomaterials Market Size, Trends and Outlook 2024-2030Industry Experts
Global Carbon Nanomaterials market size is estimated at US$2.2 billion in 2024 and primed to post a robust CAGR of 17.2% between 2024 and 2030 to reach US$5.7 billion by 2030. This comprehensive report analyzes and projects the global Carbon Nanomaterials market by material type (Carbon Foams, Carbon Nanotubes (CNTs), Carbon-based Quantum Dots, Fullerenes, Graphene).
Today's children are growing up in a rapidly evolving digital world, where digital media play an important role in their daily lives. Digital services offer opportunities for learning, entertainment, accessing information, discovering new things, and connecting with other peers and community members. However, they also pose risks, including problematic or excessive use of digital media, exposure to inappropriate content, harmful conducts, and other online safety concerns.
In the context of the International Day of Families on 15 May 2025, the OECD is launching its report How’s Life for Children in the Digital Age? which provides an overview of the current state of children's lives in the digital environment across OECD countries, based on the available cross-national data. It explores the challenges of ensuring that children are both protected and empowered to use digital media in a beneficial way while managing potential risks. The report highlights the need for a whole-of-society, multi-sectoral policy approach, engaging digital service providers, health professionals, educators, experts, parents, and children to protect, empower, and support children, while also addressing offline vulnerabilities, with the ultimate aim of enhancing their well-being and future outcomes. Additionally, it calls for strengthening countries’ capacities to assess the impact of digital media on children's lives and to monitor rapidly evolving challenges.
Important JavaScript Concepts Every Developer Must Knowyashikanigam1
Mastering JavaScript requires a deep understanding of key concepts like closures, hoisting, promises, async/await, event loop, and prototypal inheritance. These fundamentals are crucial for both frontend and backend development, especially when working with frameworks like React or Node.js. At TutorT Academy, we cover these topics in our live courses for professionals, ensuring hands-on learning through real-world projects. If you're looking to strengthen your programming foundation, our best online professional certificates in full-stack development and system design will help you apply JavaScript concepts effectively and confidently in interviews or production-level applications.
在线制作本科文凭利物浦约翰摩尔斯大学英文学位证书影本英国成绩单利物浦约翰摩尔斯大学文凭【q微1954292140】高仿真还原英国文凭证书和外壳,定制英国利物浦约翰摩尔斯大学成绩单和信封。成绩单丢失补办LJMU毕业证【q微1954292140】办理英国利物浦约翰摩尔斯大学毕业证(LJMU毕业证书)【q微1954292140】学历认证定制利物浦约翰摩尔斯大学offer/学位证成绩单英文版、留信官方学历认证(永久存档真实可查)采用学校原版纸张、特殊工艺完全按照原版一比一制作。帮你解决利物浦约翰摩尔斯大学学历学位认证难题。
《利物浦约翰摩尔斯大学毕业证书英国毕业证书办理LJMU成绩单详解细节》【q微1954292140】学位证1:1完美还原海外各大学毕业材料上的工艺:水印,阴影底纹,钢印LOGO烫金烫银,LOGO烫金烫银复合重叠。文字图案浮雕、激光镭射、紫外荧光、温感、复印防伪等防伪工艺。
主营项目:
1、真实教育部国外学历学位认证《英国毕业文凭证书快速办理利物浦约翰摩尔斯大学毕业证购买》【q微1954292140】《论文没过利物浦约翰摩尔斯大学正式成绩单》,教育部存档,教育部留服网站100%可查.
2、办理LJMU毕业证,改成绩单《LJMU毕业证明办理利物浦约翰摩尔斯大学文凭在线制作》【Q/WeChat:1954292140】Buy Liverpool John Moores University Certificates《正式成绩单论文没过》,利物浦约翰摩尔斯大学Offer、在读证明、学生卡、信封、证明信等全套材料,从防伪到印刷,从水印到钢印烫金,高精仿度跟学校原版100%相同.
3、真实使馆认证(即留学人员回国证明),使馆存档可通过大使馆查询确认.
4、留信网认证,国家专业人才认证中心颁发入库证书,留信网存档可查.
利物浦约翰摩尔斯大学offer/学位证、留信官方学历认证(永久存档真实可查)采用学校原版纸张、特殊工艺完全按照原版一比一制作【q微1954292140】Buy Liverpool John Moores University Diploma购买美国毕业证,购买英国毕业证,购买澳洲毕业证,购买加拿大毕业证,以及德国毕业证,购买法国毕业证(q微1954292140)购买荷兰毕业证、购买瑞士毕业证、购买日本毕业证、购买韩国毕业证、购买新西兰毕业证、购买新加坡毕业证、购买西班牙毕业证、购买马来西亚毕业证等。包括了本科毕业证,硕士毕业证。
特殊原因导致无法毕业,也可以联系我们帮您办理相关材料:
1:在利物浦约翰摩尔斯大学挂科了,不想读了,成绩不理想怎么办???
2:打算回国了,找工作的时候,需要提供认证《LJMU成绩单购买办理利物浦约翰摩尔斯大学毕业证书范本》【Q/WeChat:1954292140】Buy Liverpool John Moores University Diploma《正式成绩单论文没过》有文凭却得不到认证。又该怎么办???英国毕业证购买,英国文凭购买,【q微1954292140】英国文凭购买,英国文凭定制,英国文凭补办。专业在线定制英国大学文凭,定做英国本科文凭,【q微1954292140】复制英国Liverpool John Moores University completion letter。在线快速补办英国本科毕业证、硕士文凭证书,购买英国学位证、利物浦约翰摩尔斯大学Offer,英国大学文凭在线购买。
办理利物浦约翰摩尔斯大学学位证(LJMU毕业证书)毕业证详解细节【q微1954292140】帮您解决在英国利物浦约翰摩尔斯大学未毕业难题(Liverpool John Moores University)文凭购买、毕业证购买、大学文凭购买、大学毕业证购买、买文凭、日韩文凭、英国大学文凭、美国大学文凭、澳洲大学文凭、加拿大大学文凭(q微1954292140)新加坡大学文凭、新西兰大学文凭、爱尔兰文凭、西班牙文凭、德国文凭、教育部认证,买毕业证,毕业证购买,买大学文凭,购买日韩毕业证、英国大学毕业证、美国大学毕业证、澳洲大学毕业证、加拿大大学毕业证(q微1954292140)新加坡大学毕业证、新西兰大学毕业证、爱尔兰毕业证、西班牙毕业证、德国毕业证,回国证明,留信网认证,留信认证办理,学历认证。从而完成就业。利物浦约翰摩尔斯大学毕业证办理,利物浦约翰摩尔斯大学文凭办理,利物浦约翰摩尔斯大学成绩单办理和真实留信认证、留服认证、利物浦约翰摩尔斯大学学历认证。学院文凭定制,利物浦约翰摩尔斯大学原版文凭补办,Diploma,扫描件文凭定做,100%文凭复刻。
Get Started with FukreyGame Today!......liononline785
Ad
regression analysis presentation slides.
1. Regression Analysis
• Regression analysis is used in statistics to find trends in
data.
For example, you might guess that there’s a connection
between how much you eat and how much you weigh.
• In statistical modelling, regression analysis is a set of
statistical procedures for estimating the relationships
between a dependent variable(outcome: weight) and
one or more independent variable(predictors,
covariates, features: amount of food we eat).
• It provides an equation for a graph so that you can make
predictions about your data.
3. Regression gives you a useful equation, which for this chart
is:
y = -2.2923x + 4624.4
• Best of all, you can use the equation to make predictions.
For example, how much snow will fall in 2017?
y = -2.2923(2017) + 4624.4 = 0.8 inches.
• Regression also gives you an R2
value, which for this graph
is 0.702. This number tells you how good your model is.
• The values range from 0 to 1, with 0 being a terrible model
and 1 being a perfect model. As you can probably see, 0.7
is a fairly decent model so you can be fairly confident in your
weather prediction!
4. There are multiple benefits of using regression analysis:
• It indicates the significant relationships between dependent variable
and independent variable.
• It indicates the strength of impact of multiple independent variables
on a dependent variable.
In Regression analysis, we fit a curve / line to the data
points, in such a manner that the differences between the
distances of data points from the curve or line is minimized.
Regression Analysis
5. These techniques are mostly driven by three metrics (number
of independent variables, type of dependent variables and
shape of regression line).
Regression Techniques
6. •Simple Linear regression(Univariate) analysis
uses a single x variable for each dependent “y”
variable. For example: (x, Y).
•Multiple Linear regression(Multivariate) uses
multiple “x” variables for each independent
variable: (x1)1, (x2)1, (x3)1, Y1).
•Nonlinear Regression if the regression curve is
nonlinear then there is nonlinear regression
between variables
Regression Techniques
7. Regression Types
1.Simple and Multiple Linear Regression
2.Logistic Regression
3.Polynomial Regression
4.Ridge Regression and Lasso Regression (upgrades to Linear
Regression)
8. Linear Regression
• Dependent variable is continuous
• Independent variable(s) can be continuous or discrete
• Nature of regression line is linear.
• It establishes a relationship between dependent variable (Y) and one or
more independent variables (X) using a best fit straight line (also known
as regression line).
• Equation Y=m*X + c + e, where ‘c’ is intercept, ‘m’ is slope of the line and ’e’
is error term.
9. How to obtain best fit line (Value of m and c)?
• Least Square Method: A most common method used for fitting a
regression line.
• It calculates the best-fit line for the observed data by minimizing the sum of
the squares of the vertical deviations from each data point to the line.
• Error is the difference between the actual value and Predicted value and
the goal is to reduce this difference.
10. How to obtain best fit line (Value of m and c)?
• The vertical distance between the data point and the regression line is
known as Error or Residual.
• Each data point has one residual and the sum of all the differences is
known as the Sum of Residuals/Errors.
11. How to obtain best fit line (Value of m and c)?
Residual/Error = Actual values – Predicted Values
Sum of Residuals/Errors = Sum(Actual- Predicted Values)
Square of Sum of Residuals/Errors = (Sum(Actual- Predicted Values))2
Aim is to minimize this sum of square error term or Cost Fuction
13. Use the least square method to determine the equation of line of best fit for
the data. Then plot the line.
15. Metrix(s) for Model Evaluation
• Residual Sum of Squares (RSS). Sum of difference between
each actual output and the predicted output.
• Mean Square Error (MSE) is computed as RSS divided by the
total number of data points.
• Root Mean Squared Error (RMSE)
16. Metrix(s) for Model Evaluation
• R-squared is the proportion of the variance in the dependent
variable that is predicted from the independent variable.
• It ranges from 0 to 1.
• With linear regression, the coefficient of determination is equal
to the square of the correlation between the x and y variables.
• If R2 is equal to 0, then the dependent variable cannot be
predicted from the independent variable.
• If R2 is equal to 1, then the dependent variable can be predicted
from the independent variable without any error.
17. Metrix(s) for Model Evaluation
R-squared:
Formula 1: Using correlation coefficient
Formula 2: Using sum of squares.
Square this value to get the coefficient of determination
18. Example:
• Last year, five randomly selected students took a math aptitude test before
they began their statistics course. The Statistics Department has three
questions:
• What linear regression equation best predicts statistics performance,
based on math aptitude scores?
• If a student made an 80 on the aptitude test, what grade would we expect
her to make in statistics?
• How well does the regression equation fit the data?
x 95 85 80 70 60
y 85 95 70 65 70
19. What linear regression equation best predicts statistics performance, based on math aptitude scores?
If a student made an 80 on the aptitude test, what grade would we expect her to make in statistics?
How well does the regression equation fit the data?
21. What linear regression equation best predicts statistics performance, based on math aptitude scores?
If a student made an 80 on the aptitude test, what grade would we expect her to make in statistics?
How well does the regression equation fit the data?
22. What linear regression equation best predicts statistics performance, based on math aptitude scores?
If a student made an 80 on the aptitude test, what grade would we expect her to make in statistics?
How well does the regression equation fit the data?
Calculate the Value of R2
23. Linear Regression: Assumptions
• Linearity: the dependent variable Y should be linearly related
to independent variables.
• Normality: The X and Y variables should be normally distributed
• Homoscedasticity: The variance of the error terms should be
constant
• Independence/No Multicollinearity: No correlation should be
there between the independent variables.
• The error terms should be normally distributed
• No Autocorrelation: The error terms should be independent of
each other.
24. Cost Function
• The whole idea of the linear Regression is to find the best fit
line, which has very low error (cost function).
Properties of the Regression line:
• 1. The line minimizes the sum of squared difference between the
observed values(actual y-value) and the predicted value(ŷ value)
• 2. The line passes through the mean of independent and dependent
features.
25. Cost Function vs Loss Function
• The loss function calculates the error per observation,
whilst the cost function calculates the error over the whole
dataset.
26. Linear Regression: Gradient Descent
• Gradient descent is an optimization algorithm used to find the
values of parameters (coefficients) of a function that minimizes
a cost function (cost).
• The idea is to start with random m and b values and then
iteratively updating the values, reaching minimum cost.
• Steps:
1. Initially, the values of m and b will be 0 and the learning rate(α) will be
introduced to the function. The value of learning rate(α) is taken very
small, something between 0.01 or 0.0001.
The learning rate is a tuning parameter in an optimization algorithm that determines the
step size at each iteration while moving toward a minimum of a cost function.
27. Linear Regression: Gradient Descent
2. Partial derivative is calculate for the cost function equation in terms of
slope(m) and also derivatives are calculated with respect to the intercept(b)
3. After the derivatives are calculated, The slope(m) and intercept(b) are updated with
the help of the following equation.
m = m-α*derivative of m
b = b-α*derivative of b
4. The process of updating the values of m and b continues until the cost function
reaches the ideal value of 0 or close to 0.
28. Multiple Linear Regression
• The main difference is the number of independent variables
that they take as inputs. Simple linear regression just takes a
single feature, while multiple linear regression takes
multiple x values.
• Another way is to use Normal Equation with multiple
independent variables.
29. Multiple Linear Regression
• The main difference is the number of independent variables
that they take as inputs. Simple linear regression just takes a
single feature, while multiple linear regression takes
multiple x values.
ŷ = b0 + b1x1 + b2x2 + … + bk-1xk-1 + bkxk
Y = Xb
b = (X'X)-1
X'Y
30. Multiple Linear Regression: Example
Student Test score IQ Study hours
1 100 110 40
2 90 120 30
3 80 100 20
4 70 90 0
5 60 80 10
31. Multiple Linear Regression: Example
•Define X.
•Define X'.
•Compute X'X.
•Find the inverse of X'X.
•Define Y.
33. Regression Types
1.Simple and Multiple Linear Regression
2.Logistic Regression
3.Polynomial Regression
4.Ridge Regression and Lasso Regression (upgrades to
Linear Regression)
5.Decision Trees Regression
6.Support Vector Regression (SVR)
34. Logistic Regression
• Logistic Regression is used when the dependent variable(target) is
categorical or binary. For example:
• To predict whether an email is spam (1) or (0)
• Whether the tumor is malignant (1) or not (0)
• Logistic regression is widely used for classification problems
• Logistic regression doesn’t require linear relationship between
dependent and independent variables.
• Logistic regression estimates the probability of an event belonging to
a class, such as voted or didn’t vote.
35. HR Analytics : IT firms recruit large number of people, but
one of the problems they encounter is after accepting the job
offer many candidates do not join. So, this results in cost
over-runs because they have to repeat the entire process
again. Now when you get an application, can you actually
predict whether that applicant is likely to join the organization
(Binary Outcome - Join / Not Join).
Logistic Regression Example
36. Why Logistic Regression
In Linear regression, we draw a straight line(the best fit line) L1 such that the sum of distances
of all the data points to the line is minimal.
37. It uses sigmoid function is to map any predicted values of
probabilities into another value between 0 and 1.
Logistic Regression Equation
Linear model: ŷ = b0+b1x
Sigmoid function: σ(z) = 1/(1+e z
−
)
Logistic regression model:
ŷ = σ(b0+b1x) = 1/(1+e-(b0+b1x)
)
Also called logistic or logit function
38. Logistic Regression Equation
To make in the range from 0 to +infinity
To make in the range from -infinity to +infinity
Since we want to calculate value of p
39. In logistic regression, as the output is a probability value between
0 or 1, mean squared error wouldn’t be the right choice. Instead,
we use the log loss function which is derived from the maximum
likelihood estimation method.
Logistic Regression Evaluation
41. Bias
• Bias is simply defined as the inability of the model because of
that there is some difference or error occurring between the
model’s predicted value and the actual value. These differences
between actual or expected values and the predicted values are
known as error or bias error or error due to bias.
• Let Y be the true value of a parameter, and let Y^ be an estimator
of Y based on a sample of data. Then, the bias of the
estimator Y^ is given by:
• Bias(Y^)=E(Y^)–Y
• where E(Y^) is the expected value of the estimator Y. It is the
measurement of the model that how well it fits the data.
42. Bias
• Low Bias: Low bias value means fewer assumptions are
taken to build the target function. In this case, the
model will closely match the training dataset.
• High Bias: High bias value means more assumptions are
taken to build the target function. In this case, the model
will not match the training dataset closely.
• The high-bias model will not be able to capture the dataset
trend. It is considered as the underfitting model which has
a high error rate. It is due to a very simplified algorithm.
43. Variance
• The variance is the variability of the model that how much it is
sensitive to another subset of the training dataset. i.e. how much it
can adjust on the new subset of the training dataset.
• Let Y be the actual values of the target variable, and Y^ be the
predicted values of the target variable.
• Then the variance of a model can be measured as the expected value
of the square of the difference between predicted values and the
expected value of the predicted values.
44. • Variance=E[(Y^–E[Y^])2]
• where E[Yˉ]E[Yˉ] is the expected value of the predicted values. Here expected value is
averaged over all the training data.
• Variance errors are either low or high-variance errors.
• Low variance: Low variance means that the model is less sensitive to changes in the
training data and can produce consistent estimates of the target function with
different subsets of data from the same distribution. This is the case of underfitting
when the model fails to generalize on both training and test data.
• High variance: High variance means that the model is very sensitive to changes in
the training data and can result in significant changes in the estimate of the target
function when trained on different subsets of data from the same distribution. This
is the case of overfitting when the model performs well on the training data but
poorly on new, unseen test data. It fits the training data too closely that it fails on the
new training dataset.
45. Overfitting and Underfitting
Underfitting is a situation when your model is too simple for
your data or your hypothesis about data distribution is wrong
and too simple. For example, your data is quadratic, and your
model is linear.
This situation is also called high bias.
This means that your algorithm can do
accurate predictions, but the initial
assumption about the data is incorrect.
46. Overfitting and Underfitting
Overfitting is a situation when your model is too complex for your
data.
For example, your data is linear and your model is high-
degree polynomial.
This situation is also called high variance.
In this situation, changing the input data only a little, the
model output changes very much.
•low bias, low variance — is a good result, just right.
•low bias, high variance — overfitting — the algorithm outputs very different
predictions for similar data.
•high bias, low variance — underfitting — the algorithm outputs similar predictions
for similar data, but predictions are wrong (algorithm “miss”).
•high bias, high variance — very bad algorithm. You will most likely never see this.
48. Regularization
• Regularization is one of the ways to improve our model to
work on unseen data by ignoring the less important
features.
• Regularization minimizes the validation loss and tries to
improve the accuracy of the model.
• It avoids overfitting by adding a penalty to the model with
high variance.
49. LASSO stands for Least Absolute Shrinkage and Selection
Operator.
Lasso regression performs L1 regularization, i.e. it adds a factor
of sum of absolute value of coefficients in the optimization
objective.
This type of regularization (L1) can lead to zero coefficients i.e.
some of the features are completely neglected for the evaluation
of output. So, Lasso regression not only helps in reducing over-
Lasso Regression
50. In ridge regression, the cost function is altered by adding a
penalty equivalent to square of the magnitude of the coefficients.
The penalty term (lambda) regularizes the coefficients such that if the
coefficients take large values the optimization function is penalized.
Ridge regression shrinks the coefficients and it helps to reduce the model
complexity and multi-collinearity
It is also called “L2 regularization”.
Ridge Regression
51. Polynomial Regression
• A regression equation is a polynomial regression equation if
the power of independent variable is more than 1. The
equation below represents a polynomial equation:
• In this regression technique, the best fit line is not a straight
line. It is rather a curve that fits into the data points.
53. Regression vs Classification
• Classification predictions can be evaluated using accuracy,
whereas regression predictions cannot.
• Regression predictions can be evaluated using root mean
squared error, whereas classification predictions cannot.
• A classification algorithm may predict a continuous value,
but the continuous value is in the form of a probability for a
class label.
• A regression algorithm may predict a discrete value, but the
discrete value in the form of an integer quantity.