Topic 18

Regression

Concept

"When will my order arrive?" is the question Plateful's customers ask more than any other, and no menu of categories can hold the answer. It is not genuine-or-fake, not pizza-or-pasta. It is a number on a scale — 29 minutes, 38, 51 — and in principle it could be any number at all. The previous page's machinery of classes and thresholds simply has no slot for it.

Predicting quantities is the other half of supervised learning, and it is called regression — an old statistics name that stuck; nothing is regressing, and the word now just means "the model outputs a number". Delivery minutes, how many orders will land next Friday, the tip a courier is likely to get — different questions, one shape. This page gives that shape its anatomy, and ends with a two-second test for telling the halves apart.

Predicting a Quantity

A regression model's answer is a point on a continuous scale: minutes, dollars, orders. Everything upstream of that answer is the machinery you already know. The same table of past examples, features describing each order; the same training loop from Chapter 3, guessing and measuring the miss and nudging the numbers. The only thing that changed is the label column — instead of holding a kind, it holds an amount, like the actual 44 minutes a past delivery took.

What the model learns from those examples is how features push the number up or down. Longer distance pushes the estimate up; a quiet Tuesday afternoon pulls it down; a restaurant that has been slow all week pushes it back up. Training discovers how much each push is worth, and a prediction is where all the pushes land for this particular order.

Misses Have Sizes

Here is the property that makes regression feel different from classification. A classifier's verdict is right or wrong — the review was fake or it wasn't. A regression guess is almost never exactly right, and that is fine, because it doesn't need to be. The model predicts 38 minutes; the order takes 44. The guess wasn't wrong — it was off by 6. In regression, a miss has a size.

A butcher who has weighed cuts for twenty years works the same way. Hand him a piece of meat and he'll name its weight before it touches the scale — years of examples trained the guess. He is almost never exact, and nobody cares: off by 20 grams is a party trick, off by 500 is a problem. That is the whole mindset shift: a regression model's quality is its typical miss size, not a count of right answers. Chapter 6 will turn "typical miss size" into an honest score you can put in a report.

Show the Range, Not the Point

Look closely at what Plateful actually shows a hungry customer. Not "38.2 minutes" — that decimal would be theater, faking precision the model does not actually have. The app says "35–45 min", and that range is the model's uncertainty made visible: on orders like this one, the misses usually fit inside that window.

The range is better product design, not just better honesty. A customer promised 38 minutes is annoyed at minute 39; a customer promised 35–45 relaxes anywhere inside it. Same model, same guess — the difference is whether the product admits the guess is a guess. "Show the range, not the point" is a rule you can carry straight into your next feature discussion, and this book will hold Plateful to it from here on.

Which Kind, or How Much?

You now hold both halves of supervised learning, and telling them apart takes one look — at the answer, not the data. Ask what shape the wanted answer is. A kind from a fixed menu: classification. An amount on a scale: regression. The features can be identical, the training loop is identical; the fork is only at the output.

One Plateful order, two models — the fork is only in the answer shape
Which kind? · classification
"Will this order be late?" → late: 0.31 → below the threshold → predicted on time.
How much? · regression
"When will it arrive?" → ETA 38 minutes → shown as 35–45 min.

The figure hides one more lesson: those are the same order and nearly the same question. "Will it be late?" is classification; "how many minutes will it take?" is regression. Many problems can be framed either way, and the framing is a real choice with consequences — a yes/no answer is easier to act on automatically, a number carries more information for a human to judge. Who should make that choice, and how, is part of Chapter 7's story about framing problems. For now it is enough to see that the choice exists.

Common Confusions
  • "Regression means the model got worse." It is a historical statistics name and nothing more. In ML, regression simply means the model predicts a number instead of a category.
  • "A regression answer is right or wrong." It is close or far. Quality means typical miss size — off by 6 minutes on average is a statement about a model; "wrong" is not.
  • "Number problems need different data than category problems." Same table shape, same features, same training loop. Only the label's type differs — an amount instead of a kind.
  • "38.2 minutes is a more precise prediction than 35–45 minutes." It only looks more precise. The decimal doesn't shrink the model's real uncertainty — it hides it, which is worse.
Why It Matters
  • The pair is complete: any prediction idea now sorts into its shape in seconds — kind or amount. That sort is the first thing a data scientist will do with your feature request, and now you can do it first.
  • "Show the range, not the point" is a product insight you can apply this week — it turns a model's uncertainty from an embarrassment into honest design.
  • "How far off is it, typically?" is the right question to ask about any number-predicting feature — and it sets up Chapter 6, where that question gets a proper score.

Knowledge Check

Which of these is a regression problem?

  • Deciding whether a review is genuine or fake
  • Predicting the tip a courier will get on an order
  • Predicting whether a customer will leave next month
  • Sorting dish photos into pizza, pasta, or salad

The model predicted 38 minutes and the delivery took 44. How does regression treat this?

  • The prediction was wrong, the same as misclassifying a review
  • The guess was off by 6 — misses have sizes
  • The model has failed and must be retrained at once
  • The prediction counts as correct because it landed within ten minutes

Why does Plateful show "35–45 min" instead of "38.2 min"?

  • The model isn't able to produce an exact number
  • A range hides the fact that the model performs poorly
  • The range shows the uncertainty honestly, so waiting feels calmer
  • Government regulations require every delivery app to display a time range

"Will this order be late?" and "How many minutes will this order take?" — what is the relationship between these two problems?

  • The same problem framed two ways — classification or regression
  • They require two completely different datasets
  • The first one is not a machine learning problem at all
  • The second one is unsupervised, because a count of minutes has no labels

You got correct