Art of DS

Appearance

Palette
Theme
Unlock $20 one time
Sign in, or create an account

Sign in to Art of DSCreate your Art of DS account

We email you a link and a six-digit code. Either one signs you in; there is no password.Enter your email. We send a link and a six-digit code to confirm it — no password to remember. The account is free.

  • You come back to this page, right where you were.
  • Already have an account? The same email simply signs you in.

By continuing you accept the Terms and the Privacy policy.

Your account

Free accountLifetime access

Which penalty, or none?

Seven linear models side by side, the pairs people confuse, and one run in which the best predictor is not the best selector of features.

prints on 2 A4 pagesfrom 8 pages and 1 cataloguefree to read · PDF with a free accountUpdated 23 Oct 2026

Download PDF

The PDF and the Print button ask you to sign in; a free account is enough. Reading and Test yourself are open to everyone.

Side by side

The first columns are the Linear model family catalogue’s; the rest come from each page.

Say what each one answers, what it cannot see and when to reach for it, then reveal its row.

Model Penalty Zeroes coefficients? Hyperparameters Reach for it when Trap
Linear regression none No none interpretability matters as much as accuracy A coefficient is not a cause.
Ridge L2 — ‖w‖² No alpha most features carry some signal and the model must be stable Ridge never gives you a sparse model.
Lasso L1 — ‖w‖₁ Yes alpha most features are irrelevant and the model must say which Correlated features make selection unstable.
Elastic Net L1 + L2 Yes alpha, l1_ratio you want sparsity and the features are correlated Two hyperparameters means a 2-D search.
Bayesian ridge L2, learned No none tuned you need calibrated uncertainty, or data is scarce A wide interval is information, not a defect.
Polynomial none by itself No degree the curve is smooth and low-order Extrapolation is catastrophic, not merely unreliable.
Logistic L2 by default with l1_ratio C, l1_ratio you need probabilities you can trust and coefficients to defend C runs backwards from alpha.

A formula is printed only when it is shorter than the words; the others are said in words, and each page has its formula.

Easy to confuse

The “what is the difference between…” questions, in two lines each.

  • Ridge regression vs Lasso regression

    Ridge shrinks every coefficient and keeps them all; lasso sets some exactly to zero.

    Ridge when most features matter; lasso when most do not and the model must prove which.

  • Lasso regression vs Elastic Net

    Of a group of correlated features lasso tends to keep one, almost at random; elastic net tends to keep the group.

    Elastic net when features come in correlated groups, or when you do not know which penalty fits.

  • Linear regression vs Logistic regression

    Both score a weighted sum of the features; logistic regression turns it into a probability.

    Logistic for a yes-or-no outcome, read as log-odds; linear for a number.

  • α vs C

    Ridge and lasso's α is the penalty's strength; logistic regression's C is its inverse.

    Larger α means more penalty; larger C means less. Search both on a log scale.

One real run

Fifty features, five with signal and each with a near-twin; each penalty tuned by cross-validation.

Model Test MSE Nonzero True kept Twins Stable
ols 6.95 50 5 5 1.00
ridge 6.14 50 5 5 1.00
lasso 4.46 20 4 2 0.45
elastic-net 5.10 35 5 5 0.63

“Lasso predicts best and still chooses badly.”

“Elastic net keeps the pairs together.”

“Ridge shrinks and keeps everything.”

The run and these lines are the worked example on Regularization, as it printed: 50 features, 5 with signal, each with a near-twin; 100 training rows

Which one?

  1. Is the outcome a class?

  2. Do most features matter?

  3. Is the relation curved?

  4. Do you need uncertainty on each prediction?

Each answer is from its page’s “Why & when”.

All 31 traps on these pages

Each is the opening line of a pitfall; its page says why.

Linear regression

  • A coefficient is not a cause.
  • A high score is not a good fit.
  • Extrapolation is unsupported.

Ridge regression

  • Standardise first.
  • Ridge never gives you a sparse model.
  • α does not transfer between datasets.
  • Do not read ridge coefficients as effect sizes.

Lasso regression

  • Standardise first — and here it changes which features are selected.
  • Correlated features make selection unstable.
  • Selection is not significance.
  • α is not comparable to ridge's α.

Elastic Net

  • Two hyperparameters means a 2-D search.
  • l1_ratio near 0 is ridge with extra steps.
  • Standardise first.
  • The grouping effect is a tendency, not a guarantee.

Bayesian linear regression

  • A wide interval is information, not a defect.
  • "Bayesian" here does not mean fully Bayesian.
  • The intervals are only as good as the assumptions.
  • Scale your features.

Polynomial regression

  • Powers explode in magnitude.
  • Extrapolation is catastrophic, not merely unreliable.
  • Degree is a capacity dial and needs held-out selection.
  • Watch the feature count.

Logistic regression

  • C runs backwards from alpha.
  • Coefficients are log-odds, not probabilities.
  • Scale your features.
  • Perfect separation breaks the unregularized model.

Regularization

  • Unscaled features make the penalty arbitrary.
  • Do not penalise the intercept.
  • α must be chosen on held-out data.
  • Regularized coefficients are biased on purpose.

Have a promo code?

A code that takes 100% off unlocks everything at once. A smaller one takes its share off the price in the payment window: enter the same code there.

Write to support

A question, a problem with access, a refund? Write to us and we answer by email.

What is it about?

Your address is used only to answer you.

Message sent

Thank you. We will reply to the address you gave, by email.

Or write to us directly

support@artofds.com

Message sent Thank you. We will reply to the address you gave, by email.

Check the email address: we need it to reply.

That is our own address. Enter yours, so the reply reaches you.

This address cannot receive email. Check it for a typo.

Write a little more: at least 10 characters.

Too many messages in a short time. Try again in a few minutes.

The message could not be sent. Please write to us directly: support@artofds.com