What is the ElasticNet regression?
In our previous articles, we discussed Ridge regression and Lasso regression. Lasso regression gives a good performance, but it has some disadvantages. They are:
- If the number of variables is more than the number of observations, then the Lasso regression fails.
- If there is a high correlation between the predictor variables, Lasso regression selects one of the correlated variables and leaves the others. This may decrease the performance of the model.
The ElasticNet regression addresses these problems. In the ElasticNet regression, we try to minimize this expression:
λ1 and λ2 are two variables that control the penalty on predictor variables. This penalty can also be expressed like the following:
When α is 1, the ElasticNet regression behaves like the Ridge regression. And when α is 0, the ElasticNet regression behaves like the Lasso regression.
ElasticNet Regression using Python
Let’s say we are given a set of car models along with their horsepower, weight, acceleration, and mpg or miles driven per 1 gallon of gasoline. We want to create an ElasticNet regression model using which we can determine the mpg of a car from its weight, horsepower, and acceleration.
We can use the following Python code for this ElasticNet regression model…






0 Comments