You must be logged in to take this course → LOGIN | REGISTER NOW

**Simple Linear Regression**

Regression is one of the most common data science problems. It, therefore, finds its application in artificial intelligence and machine learning. Regression techniques are used in machine learning to predict continuous values, for example predicting salaries, ages or even profits. Linear regression is the type of regression in which the correlation between the dependent and independent factors can be represented in a linear fashion.

Linear regression is a linear approach to modeling the relationship between a scalar response and one or more explanatory variables. The case of one explanatory variable is called a simple linear regression. For more than one explanatory variable, the process is called multiple linear regression. This term is distinct from multivariate linear regression, where multiple correlated dependent variables are predicted, rather than a single scalar variable.

Simple Linear Regression is the type of regression in which a single independent variable is used to predict the values of the dependent variable. It is the simplest of regression models.

For a simple regression problem, the above equation can be simplified as:

For deeper understanding behind the mathematics of Simple Linear Regression, use the following resources:

In this practise session, we will learn to code Simple Linear Regression.

We will perform the following steps to build a Simple Linear Regressor using a very simple dataset.

Step 1. Data Preprocessing

- Importing the libraries.
- Importing the data set.
- Classifying dependent and independent variables.
- Creating training and test sets.

Step 2. Simple Linear Regression

- Creating a Simple Linear Regressor.
- Training the regressor with training data.
- Predicting the salary for a test set.
- Calculating the accuracy of the predictions.
- Comparing Actual and Predicted Salaries for the test set.

**Click on Start/Continue Hackathon to go to the practise page.**

### Hackathon Reviews

**857 USERS ENROLLED**

## helpful

5good to start from scratch

## Simple and Clean

5The code is explained very well. The outputs are printed in a systematic manner. Good practice!

## Should explain each and every line.

4You should explain each and every line why we; ‘re using this and what are its uses. Cause without understanding there is no use even If you know the code. We can get the same code on any website, but understanding matters the most.

2it’s okay….

## Linear Regression

5Perfect start to machine learning