What is Linear Regression?
Linear Regression is being used to make a prediction based on other variables. There are two types of variables in Linear Regression.
- independent variable
- dependent variable
eg a dataset of people with their favorite movie genre
Age | Gender | Genre |
24 | One | Thriller |
23 | 0 | Action |
12 | 0 | Animation |
30 | One | Comedy |
16 | One | Animation |
According to this dataset, age and gender are independent variables while genre is a dependent variable. By applying Linear Regression to this dataset, we can come up with the model to best predict a person's favorite movie genre by providing age and gender.
Type of Linear Regression
- Simple Linear Regression
- Multiple Linear Regressions
Simple Linear Regression
In Simple Linear Regression, there is only one independent variable and one corresponding dependent variable. Simple Linear Regression can be written as:
y = a + bx + ε
- a: y interceptor
- b: coefficient or slope
- ε(Epsilon): error
Dataset:
https://www.kaggle.com/datasets/peterkmutua/student-hours-scores
Multiple Linear Regression
In Multiple Linear Regression, we can find the relationship between 2 or more independent variables.