## What is Elastic net Regression?

Elastic net is a regularized linear regression model.

### What is Regularization?

Linear Regression model can face problems like overfitting when the coefficients or the weights of the feature becomes very large. This problem can be resolved by techniques like regularization in which an additional cost (penalty) is added to the cost function. The regularization parameters reduce the coefficient values and hence the weightage of features which makes the model more generalised and solves problems like overfitting.

### Regularization in Linear Regression

There are three types of regularized linear regression models:

### 1. Lasso Regression (L1 regularization)

Lasso is a regularized regression model which adds the absolute values of coefficients as the penalty factor to the cost function.

L = âˆ‘(Å¶iâ€“ Yi)Â² + Î»âˆ‘|Î²|

The first part of the equation is **âˆ‘( Å¶iâ€“ Yi)Â²** squared sum of error and the second part is **Î»âˆ‘|Î²| **regularization parameter (absolute sum of coefficients).

### 2. Ridge Regression (L2 regularization)

Ridge is a regularized regression model which adds the squared values of coefficients as the penalty factor to the cost function.

L = âˆ‘(Å¶iâ€“ Yi)Â² + Î»âˆ‘Î²Â²

The first part of the above equation is **âˆ‘( Å¶iâ€“ Yi)Â²** squared sum of error and the second part is ** Î»âˆ‘Î²Â² **regularization parameter (squared sum of coefficients).

1. Lasso regressioncan be used for feature selection whileridge regressiondoesnot support feature selection.2. Lasso regressioncan be used in cases where less features are significant as it reduces the value of insignificant features to zero whereasRidgeregressioncan be used in cases where more no. of features are significant.

### 3. Elastic net Regression

Elastic net is a modified version of linear regression that adds regularization penalties from both lasso and ridge regression during the training.

L = âˆ‘(Å¶iâ€“ Yi)Â² + Î»âˆ‘Î²Â² + Î»âˆ‘|Î²|

The first part of the above equation is **âˆ‘( Å¶iâ€“ Yi)Â²** squared sum of error and the second part is **Î»âˆ‘Î²Â² + Î»âˆ‘|Î²|****Â **regularization parameter from both ridge and lasso regression.

## Advantages of Elastic net Model

Ridge Regression is not capable of feature selection.Â Since the Elastic net model combines penalties from both l1 and l2 regularization. It has characteristics of both lasso and ridge regression hence it can perform **feature selection** and **regularization** at the same time.