What is linear regression?
Linear regression tries to find a linear relationship between the predictor variables or the features and the target variable. The target variable is the dependent variable here and the features or the predictor variables are the independent variables.
A linear regression can be expressed using the following equation:
Y is the target variable, X1, X2, … Xn are the predictor variables or the features. And e is the error called the residual. β0, β1, … βn are called the coefficients, and they are selected in such a way that e or the error is minimum.
What is simple linear regression?
When linear regression involves only one feature, we call it a simple linear regression. So, a simple linear regression can be expressed using the following equation:
As we discussed, linear regression tries to find a linear relationship between the target and the predictor variables. So, the relationship can be expressed with a line. Here, are the coefficients. indicates the y-intercept of the line and indicates the slope of the line.
Simple Linear Regression using Python
Let’s say there is a restaurant. Different people come to the restaurant at different times, and they provide different amounts of tips. We have a dataset that contains various information, such as total bill amount, tip amount, sex, day, time, etc. We are interested in knowing the relationship between the tip amount and the total bill amount…






0 Comments