✕
CN EN

Machine learning / Feature selection (LASSO)

Your data stays in your browser: files are read and processed on your device, never uploaded to any server, and cleared when you close the page. Free, no sign-in.

How to read it

Feature selection (LASSO)

LASSO adds an L1 penalty λ·Σ|coefficient| to linear regression: the larger λ, the more coefficients are shrunk to exactly 0; the rest are the selected features. Each feature is first standardised (mean 0, SD 1) so the penalty treats them equally.

The first chart shows the cross-validated error (±1 SE) for each λ: the “minimum” rule takes the lowest point; the “one-standard-error” rule takes the largest λ whose error is within one SE of the minimum, giving fewer and more stable features.

The second chart is the coefficient path: reading from right (large λ) to left, features that leave 0 earlier matter more; “entry_step_on_path” in the table gives the step at which each feature enters.

Among highly correlated features LASSO tends to keep only one; a feature shrunk to 0 is not necessarily unrelated to the outcome. With few samples the selection varies with the fold split, so try another seed to check stability.

The selected-feature table gives standardised and original-unit coefficients; CV R² = 1 − cross-validated MSE / outcome variance.

Method

Tibshirani (1996) J R Stat Soc B 58:267–288; solved by coordinate descent (Friedman et al. 2010, J Stat Softw 33:1); the objective 1/(2n)·||y − Xβ||² + λ||β||₁, λ grid and k-fold choice match scikit-learn LassoCV; the one-standard-error rule follows Hastie et al., The Elements of Statistical Learning.

Data size

Runs in your browser: up to roughly 2 million sample × feature cells (e.g. 500 × 4,000) is recommended.

Need a full analysis?

Send us your data and research question and you will receive a written plan within 1 working day: analysis steps, parameter rationale, deliverables and timeline. Quoted per project.