Simple Linear Regression With Train and Test Data

What is simple linear regression and why?

It is also a linear regression model with one dependant and independent variable which can be used to predict data using linearity.

Simple linear regression is used to generate a linear function like y=mx+c for a dataset considering one data type as x values and another data type as y values.

If you have a linear function, you just need to provide your x values, it will provide y values to you. Similarly, after creating the linear model (simply linear function) you can predict the y values by providing x values as the independent variable.


1. Importing all the python modules that we use in this section.

2. Importing the dataset and define x and y variables.