ElasticNet Regression
ElasticNet blends the L1 and L2 penalties into a single model, inheriting Lasso's sparsity and Ridge's stability when features are correlated.
The ElasticNet Loss
ElasticNet minimises: SSR + \u03b1[\u03c1\u03a3|\u03b2\u1d62| + (1-\u03c1)\u03a3\u03b2\u1d62\u00b2], where \u03c1 (l1_ratio) controls the mix. Setting \u03c1=1 gives pure Lasso; \u03c1=0 gives pure Ridge.
Fitting ElasticNet with Cross-Validation
When ElasticNet Shines
ElasticNet is the default choice in high-dimensional settings where both sparsity and correlated features are present — common in genomics and text modelling.
Grouping Effect
Unlike Lasso, ElasticNet tends to include or exclude correlated features together (the grouping effect). If you have a cluster of genes that collectively predict a disease outcome, ElasticNet is more likely to retain all of them than Lasso, which would arbitrarily pick one.