One of most fundamental and frequently employed Machine Learning methodologies is linear regression. It’s included in Supervised Learning. It’s a statistical procedure for undertaking predictive modeling. Earnings, income, age, product cost, or other constant or quantitative variables are forecasted employing linear regression.

The linear regression methodology reveals a relationship between one dependent and several independent variables. Because linear regression reveals a linear correlation, it indicates how the quantity of the dependent variable alters the value of the independent variable alters.

The connection between components is illustrated by a sloped straight path in the regression model.

## Sorts of Linear Regression

There exists in total of 2 sorts of Linear Regression and they are:

**Simple Linear Regression (SLR):**SLR is a Linear Regression technique that takes a specific independent factor to estimate the value of a quantitative predictor variables.**Multiple Linear Regression (MLR):**MLR is a Linear Regression approach which utilises more than single independent variable to estimate the value of a quantitative predictor variables.

## Line of Linear Regression

- A regression line is a straight line which depicts the correlation between the predictor and target variables. There are two sorts of correlations that can be illustrated by a regression line:
- Positive Linear Relation: A positive linear correlation when the predictor variable increases on the Y-axis while the target variable increases on the X-axis.
- Negative Linear Relation: A negative linear correlation existed when the predictor variable decreases on the Y-axis while the target variable increases on the X-axis.

## Determining a line with best fit

- During the usage of linear regression, our major objective is to establish the best fit line, which suggests that the variance between forecasted and original values should be as small as possible.
- The path with the best fit will have the smallest amount of error.
- Varying weights or coefficients of lines produce different regression lines, thus we must identify the optimal quantities to achieve the best fit line, which we can do employing the cost function.

## Cost Functionality

- The cost function is utilized to forecaste the quantities of the coefficients for the line of best fit, and the varying quantities for weights or coefficients of line gives the different trajectory of regression.
- The regression coefficients or weightings are adjusted employing the cost function.
- It measures the performance of a regression model.
- This functionality can be employed to estimate the precision of a map functionality that maps an input parameter to an outcome variable.
- The hypothesis functionality is another name for this mapping functionality.

## Residual

- Residuals are the variations between both the true value and the projected value.
- The residual will be significant if the recorded points are distant from the regression, and the cost functionality will be large if the reported values are far from the linear regression.
- If all the scattering points are proximal to the line of regression, the residual and thus the cost functionality will be minimal.

## Gradient Descent

- Gradient Descent: By computing the gradient descent of the cost functionality, it is centrally utilized to minimizing the MSE.
- Gradient descent is a methodology for adjusting line coefficients by lowering the cost functionality in a statistical model.
- It is accomplished by selecting a random selection of correlation coefficients and then iteratively updating the quantities to obtain at the lowest cost function.

## Determining the performance of a model

- The Goodness of Fit is an indicator of how well a line of regression fits a data collection.
- Optimization is the procedure of choosing the optimal solution from a variety of possibilities.
- This methodology can be accomplished by the r-square procedure.