Unit 49Fitting a Linear Regression

Linear regression is a form of predictive statistical modeling that aims at explaining all or some of a variable’s variance using a linear model. It’s a supervised modeling technique: you must train (“fit”) the model before using it for prediction.

Ordinary Least Square Regression

Ordinary least squares (OLS) regression relates independent variables (predictors) and dependent variables (predicted value). The model treats the predicted value reg(xi) as a linear combination of predictors xi. The differences between the real yi and predicted values are called residuals. In the case of a perfect fit, all residuals are zero. The sum of possibly weighted (with weights wi>0) squared residuals, SSR, determines the ...

Get Data Science Essentials in Python now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.