Elastic net — lasso's zeros with ridge's grouping
Elastic net adds both penalties: an L1 term that can zero a coefficient and an L2 term that prefers to split weight across correlated columns. The mixing parameter l1_ratio is 1 for pure lasso and 0 for pure ridge. Values around 0.5 are where the grouping behavior actually shows up.
Use it when the CSV has blocks of columns that measure the same thing, such as several correlated lab readings. Lasso would keep one reading and drop the rest. Elastic net tends to keep the block, with smaller coefficients, which is the model you want if any one reading might be missing at prediction time.
You now have two knobs, alpha and l1_ratio. Tune them on a grid against a validation fold. Tuning only alpha at l1_ratio 1 is just lasso with extra steps.
Settings that change this fit
- l1 ratio
- Share of the penalty that is L1. Near 1, coefficients hit zero. Near 0, they only shrink.
- alpha
- Overall penalty strength, applied after the mix is chosen. It is not comparable to a ridge alpha unless l1_ratio is 0.