# Linear Regression

## Introduction

Linear Regression is one of the fundamental supervised-machine learning algorithm. While it is relatively simple and might not seem fancy enough when compared to other Machine Learning algorithms, it remains widely used across various domains such as Biology, Social Sciences,Finance, Marketing.

### What is supervised learning?

In supervised learning, you have an input-output pair.And you will try to map the given input to output by training the input-output pair. Another type of machine learning algorithm is unsupervised learning, in this, you don’t have an output variable. You will try to group the input variables by their similarities.

### What is Regression?

Regression is a statistical process of estimating the relationship between a dependant variable and several independent variables. In other words, it can be said that linear regression suggests that the output variable can be represented as a linear combination of the input variables.

If the number of input variables is one, then it is called simple linear regression.

### Y = a + bX

If there is more than one input variable, then it is called multiple linear regression.

a represents the slope of the line i.e the angle of the line

b represents the intercept of the line on the y-axis i.e the place where the line meets the y-axis

### How does linear regression work?

In linear regression, what we try to do is to reduce the sum of the squared distances from the points to the regression line i.e MEAN SQUARED ERROR. This is referred to as the cost function of the model. The main motto of any machine learning model is to reduce this cost function. How to reduce the cost function? By iterating through different values of slope a and intercept b. How does this iteration take place? It happens through Gradient Descent Algorithm.

### Types of Linear Regression Model

Depending on the number of predictor variables, Linear Regression can be classified into two categories:

1. Simple Linear Regression — One predictor variable.
2. Multiple Linear Regression — Two or more predictor variables.

### The top benefits of linear regression in machine learning

#### Forecasting

Atop advantage of using a linear regression model in machine learning is the ability to forecast trends and make predictions that are feasible. Data scientists can use these predictions and make further deductions based on machine learning. It is quick, efficient, and accurate. This is predominantly since machines process large volumes of data and there is minimum human intervention. Once the algorithm is established, the process of learning becomes simplified.