Classification, Regression or Clustering: Which One Solves Your Problem
Last updated:
The shape of the answer gives it away
Most business owners come to us with a goal, not a technique. Reduce stock-outs. Stop losing customers. Price jobs better. Each goal hides one or more concrete questions, and each question has a shape of answer. Once you see the shape, the type of machine learning problem is obvious, and so are a lot of the practical decisions that follow.
| If the answer is... | It is... | Example question |
|---|---|---|
| One of a fixed set of labels | Classification | Will this customer renew: yes or no |
| A number on a scale | Regression | How many hours will this job take |
| Groups you did not define in advance | Clustering | What kinds of customers do we actually have |
That table does most of the work. The rest of this post is about the traps in each, which is where the money is lost.
Classification: predicting a category
Classification models pick a label. Sometimes there are two options (fraud or not fraud), sometimes many (which of twelve departments should handle this email). Under the hood, most classification models produce a probability for each label, and you choose the cut-off.
- Will this lead convert
- Is this transaction suspicious
- Which product category does this supplier line belong to
- Is this support ticket urgent, normal or low priority
- Will this patient miss their appointment
The trap is treating the output as a verdict. A model that says 70% likely to churn is telling you something different from one that says 95%, and throwing that away by reducing it to yes or no wastes information. Keep the probability and set the threshold according to what a mistake costs. We go into that in our piece on precision and recall.
Regression: predicting a number
Regression predicts a quantity. The word comes from statistics and has nothing to do with going backwards, which confuses everyone the first time.
- Units of each product sold next week
- Days until an invoice is paid
- Price a used vehicle will fetch at auction
- Hours an engineer will need on a maintenance job
- Energy use of a building tomorrow
The trap here is the single number. A forecast of 140 units is far less useful than 'probably between 110 and 170'. The range tells a buyer how much safety stock to hold; the point estimate encourages false confidence. Ask for prediction intervals, and be suspicious of any supplier who cannot provide them.
A second trap: some number problems are better framed as categories. A logistics firm does not always need to know that a parcel will arrive in 3.4 days. It needs to know whether it will miss the promised date. Turning regression into classification can make the model simpler and the result easier to act on.
Clustering: finding groups nobody defined
Clustering has no answers to learn from. It looks at a set of things, such as customers, products or delivery routes, and groups the ones that behave alike. It is unsupervised, in the jargon.
A garden centre chain might cluster its stores by what they sell and when. It may find that two branches it treats as 'rural' behave more like its city stores, because of a nearby housing estate. That is actionable: change the stock mix.
The trap is that clustering always produces groups. You ask for five, you get five. Whether those groups are real, stable and useful is a business judgement, and it needs someone who knows the customers to look at them and say whether they make sense.
One goal, several questions
Real projects often combine types. Take 'stop losing customers' for a software subscription business with 4,000 accounts:
- Cluster accounts by how they use the product, to understand who you have
- Classify each account's risk of cancelling in the next 60 days
- Regress the expected revenue at stake for each at-risk account
- Rank the retention team's call list by risk multiplied by revenue
Step four is plain arithmetic, not machine learning, and it is where the value lands. We see a lot of projects that stop at step two and wonder why nothing changed. There is more on this particular problem in our churn prediction guide.
Quick tests before you commit
- Can you write the question as one sentence with one answer? If not, split it.
- For classification: are there enough past examples of each category, especially the rare one?
- For regression: is the number recorded accurately, and would a range be acceptable?
- For clustering: who will look at the groups, and what will they change if the groups are interesting?
- For all three: what is the simple baseline, and how much better does the model need to be?
The type of problem is decided by the question. The value of solving it is decided by what someone does with the answer.
Where SpiderHunts comes in
In a first workshop at SpiderHunts we usually rewrite a client's goal into three or four one-sentence questions, label each as classification, regression or clustering, and estimate the value of each answer. It is often clear within an hour that one question is worth building and the others are not. If you want to go further, our machine learning service covers the full build, and the machine learning guide explains the process from data to deployment.
Frequently asked questions
Is predicting yes or no classification or regression?
Can clustering predict anything?
Which type of machine learning problem is easiest?
Is forecasting a regression problem?
Have a question you would like a model to answer?
Write it down in one sentence and send it over with a description of your data. We will tell you which kind of problem it is and whether it is worth building.