# 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. Linear Regression Models are extremely powerful and can be used to forecast trends & generate insights.

### 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.

### Beneficial to small businesses:

By altering one or two variables, machines can understand the impact on sales.Since deploying linear regression is cost-effective, it is greatly advantageous to small businesses since short- and long-term forecasts can be made when it comes to sales. This means that small businesses can plan their resources welland create a growth trajectory for themselves. They will also be to understand the market and its preferences and learn about supply and demand.

### Preparing Strategies:

Since machine learning enables prediction, one of the biggest advantages of a linear regression model in it is the ability to prepare a strategy for a given situation, well in advance, and analyze various outcomes. Meaning full information can be derived from the regression model of forecasting there by helping companies plan strategically and make executive decisions.

CloudPrisma has expertise in python, used flask, Flask_cors framework, numpy, pandas,matplotlib, seaborn, dataframe – to build Crime Analytics . The various analytics trends and Prediction results are visualized as example:

• Predicted current / future year Jan-Dec Monthly trend of Crime
• Top 5 Current Year Predicted Crimes
• Predicted Crime Analysis by Area & Timeslot
• Hot Spots Area