LINEAR REGRESSION

Simple linear regression is a statistical approach for summarizing and studying connections between two continuous (quantitative) variables. Linear regression is a linear model in which a linear connection is assumed between the input variables (x) and a single output variable (y). In this case, y may be determined using a linear combination of the input variables (x). A basic linear regression approach is used when there is just one input variable (x). Many linear regression is the approach used when there are multiple input variables.

Linear regression algorithms are used in a variety of applications, including financial portfolio prediction, wage forecasts, real estate projections, and traffic forecasting to arrive at ETAs.

THE MAIN CODE OF SIMPLE LINEAR REGRESSION

  • from sklearn.linear_model import LinearRegression

Full Code Exercise of Linear Regression

For the Medical Cost dataset (Download the dataset here), we will create a Linear Regression model. The dataset includes independent and dependent features such as age, gender, BMI (body mass index), children, smoker, and geography. Individual medical expenditures invoiced by health insurance will be predicted.