Univariate Linear Regression
Here, you’ll learn more about Regression and the concepts of Univariate Linear Regression.
Univariate Linear Regression
In Univariate Linear Regression, we have one independent variable which we use to predict a dependent variable .
We will be using the Tips Dataset from Seaborn’s Datasets to illustrate theoretical concepts.
We will be using the following columns from the dataset for Univariate Analysis.
-
Total_bill: It is the total bill of food served.
-
Tip: It is the tip given on the cost of food.
Goal of Univariate Linear Regression: The goal is to predict the “tip” given on a “total_bill”. The regression model constructs an equation to do so.
If we plot the scatter plot between the independent variable (total_bill) and dependent variable (tip), we will get the plot below.
-
We can see that the points in the scatter plot are mostly scattered along the diagonal.
-
This is an indication that there can be some positive correlation between the total_bill and tip. This will be fruitful in modeling.
Working
The univariate Linear Regression model comes up with the following equation of the straight line.
Or
Goal: Find the values of and , where and are the parameters, so that the predicted tip () is as close to the actual tip () as possible. Mathematically, we can model the problem as seen below.
=
-
is the cost function, which an algorithm tries to minimize by finding the values of and . These values give us the minimum value of the above function.
-
is the actual output value of a training instance , where
-
...