DYAP 0114 min read + 15–25 min practice

Classification and Regression

My DYAP →

Classification predicts categories; regression predicts numbers. The distinction determines the model output, evaluation metrics and operational decisions.

Editorial learning illustration for Classification and Regression
Visual guide · Use the flow from inputs and evidence to models, outputs and human decisions.

What you will be able to do

  • Explain classification and regression accurately in your own words.
  • Recognise how the concept appears in real AI products and professional work.
  • Identify an important limitation, risk or evaluation requirement.
  • Apply the concept through a practical activity and knowledge check.

Build the right mental model

Binary classification chooses between two categories, multiclass classification chooses one of several, and multilabel classification can assign several categories at once. Regression estimates a continuous quantity.

Classification models often output probabilities. A threshold turns the score into an action, so the operational policy is as important as the model. Regression error should be examined across the range—not only as one average.

Some problems can be framed in more than one way. Predicting exact delivery minutes is regression; predicting late/on-time is classification. Choose the framing that supports the actual decision.

Choose the output before choosing an algorithm

Imagine a service desk wants to respond sooner to delayed support tickets. “Use AI on the tickets” does not specify a learning problem. Estimating the number of minutes until a reply is a regression task; predicting whether a reply will exceed a two-hour target is classification. Both may use similar inputs, but they return different information and support different decisions. A coordinator arranging staffing may need a time estimate, while an alert system may need a yes-or-no escalation signal.

A label must have a precise definition. Does reply time mean the first automated acknowledgement or the first useful staff response? Does the clock include nights and weekends? Does a ticket with no reply get excluded? Different answers produce different datasets. Write the definition before collecting examples, otherwise apparently accurate predictions may measure the wrong service outcome.

Separate a model score from an operational decision

A classifier can produce a score and a decision rule can convert that score into a category. A score of 0.7 is not automatically a well-calibrated 70% probability. Calibration asks whether similar scored cases have corresponding observed frequencies. Even when probabilities are calibrated, the choice of action depends on the consequences of errors. A low-cost reminder may justify a different threshold from an expensive intervention.

For regression, inspect the size and direction of errors. Predicting 40 minutes when the actual delay is 50 gives a signed error of −10 minutes if error is defined as prediction minus actual. Absolute error is 10 minutes. Underprediction can harm scheduling differently from overprediction. An average error alone can hide a pattern in which long delays are consistently underestimated.

Choose evidence that matches the task

Classification evaluation counts correct and incorrect categories. Regression evaluation compares predicted and observed quantities. Mean absolute error is the average of absolute differences and retains the original unit. Squared-error measures place more weight on large misses. There is no universally best metric: write down the practical consequence of a mistake and choose a measure that makes it visible.

Always compare with a simple baseline, such as predicting the typical reply time or the most frequent class. Keep the final evaluation cases separate from development choices. A complex model that does not improve on a useful baseline adds maintenance without demonstrated benefit. This lesson’s small arithmetic example illustrates metrics; four cases cannot establish real-world model quality.

01

Binary classification

Two possible classes, such as attack or normal.

02

Multiclass classification

One category selected from three or more.

03

Regression

A numeric prediction such as cost or temperature.

04

Problem framing

Translating a real need into a precise ML task.

Illustrative example

Worked example: the same four tickets, two questions

Use fictional actual reply times of 20, 40, 80 and 100 minutes. A regression model predicts 30, 35, 65 and 110 minutes. Prediction-minus-actual errors are +10, −5, −15 and +10. Absolute errors total 40 minutes, so mean absolute error is 40 ÷ 4 = 10 minutes. Mean signed error is zero, but the predictions are not perfect: positive and negative mistakes cancel.

Now define “late” as strictly greater than 60 minutes. The actual labels are not late, not late, late and late. Applying that same cutoff to the predicted times gives the same four labels, so classification accuracy is 4 ÷ 4 = 100%. This does not contradict the regression error. The labels ignore how far predictions are from the actual times.

If the operational question changes to “How many minutes should we reserve?”, the classifier is insufficient even though it scored perfectly here. Preserve the task definition beside the result so a good score on one question is not presented as success on another.

Practical activity

  1. Spend 5 minutes defining a fictional delivery task and the meaning of “late”. Use actual times 15, 30, 60 and 90 minutes and predictions 20, 20, 75 and 85 minutes.
  2. Spend 7 minutes calculating signed error, absolute error and mean absolute error. Then classify both columns using “late means greater than 60 minutes”.
  3. Spend 5 minutes comparing the numerical and categorical conclusions. Write one action supported by each output and one limitation of this tiny dataset.
Compare with an explained example answer

The signed errors are +5, −10, +15 and −5 minutes. Absolute errors sum to 35, so MAE is 8.75 minutes. Actual late labels are no, no, no and yes; predicted late labels are no, no, yes and yes. Three of four classifications agree, giving 75% accuracy. The third case is a false late alert.

An estimated arrival time can support scheduling, while a late label can trigger a reminder. Neither four-case result establishes performance across different routes, days or customers. A suitable next step is evaluation on representative held-back cases, not declaring one model universally better.

Write your answers in a learning journal. The value comes from connecting the concept to your own profession.

Test your understanding

Q1Can regression error be nonzero when a derived classifier is perfectly accurate?

Answer: Yes. Different numerical predictions can fall on the same side of a cutoff as the actual values. Category agreement loses information about error size.

Q2Why is zero mean signed error not proof of accurate predictions?

Answer: Overestimates and underestimates can cancel. Inspect absolute error and the distribution of mistakes as well.

Q3What must be specified before learning a late-ticket label?

Answer: Define the clock, the target time, the boundary rule and how missing replies are handled. Otherwise “late” does not mean the same thing across records.

Reflection

If you cannot explain the answer without reading it, revisit the core explanation and example before continuing.

Important industry resources

These links lead to official organisations, industry laboratories or established open-source learning projects.