Choosing the Right Type of ML
Different machine learning problems need different approaches. The easiest way to choose the right type of ML is to first understand what kind of answer you want from the model.
Start with the problem, not the algorithm.
Before choosing a machine learning algorithm, ask: Do I have known answers? What kind of answer do I want? Or am I trying to discover hidden groups?
Step 1: Do You Have Known Answers?
First, ask whether your training data already contains the correct answers.
If the correct answers are available, you are usually working with supervised learning.
If the correct answers are not available and you want the model to discover patterns, you may be working with unsupervised learning.
Learn from examples with known answers.
Discover patterns or groups.
If You Have Known Answers: What Are You Predicting?
If you have labelled training data, look at the type of answer you want to predict.
Is it a category or a number?
Example: Spam or Not Spam
Example: House Price = $350,000
Category → Classification
Number → Regression
Example: Predicting Spam Emails
Imagine you have thousands of emails.
Each email has already been labelled as either Spam or Not Spam.
The model needs to predict one of the known categories: Spam or Not Spam.
Therefore, this is a classification problem.
Example: Predicting House Prices
Now imagine you have information about thousands of houses and their actual selling prices.
You want to predict the price of a new house.
The model is predicting a numerical value such as $350,000.
Therefore, this is a regression problem.
Example: Discovering Customer Groups
Now imagine an online store has thousands of customers.
The store has customer information, but nobody has labelled the customers into groups.
The company wants to discover groups of customers who behave similarly.
The goal is not to predict an existing category. The goal is to discover groups in the data.
Therefore, this is a clustering problem.
What About Reinforcement Learning?
Reinforcement learning is different from the problems we have discussed so far.
Instead of simply predicting a label, number, or group, an agent interacts with an environment and learns from the results of its actions.
A simple example is a game-playing agent.
It takes actions, sees what happens, receives rewards or penalties, and gradually learns which actions lead to better results.
The Simple Decision Tree
You can use this simple process when starting a machine learning problem.
You have examples with known answers.
You want to discover patterns or groups.
One Problem Can Make the Choice Clear
Imagine an e-commerce company wants to use machine learning.
Look at these four different problems:
| Problem | Goal | ML Type |
|---|---|---|
| Detect fraudulent orders | Predict Fraud / Not Fraud | Classification |
| Predict product sales | Predict a number | Regression |
| Find customer groups | Discover similar customers | Clustering |
| Train an agent to play a game | Learn actions from rewards | Reinforcement Learning |
Do Not Choose an Algorithm Too Early
A common beginner mistake is to immediately ask: "Should I use Decision Tree, KNN, or another algorithm?"
That is the wrong first question.
First understand the machine learning problem.
For example, if you discover that your problem is classification, you can then compare suitable classification algorithms.
The Whole Lesson in One Picture
Choose the ML Type Based on the Problem You Are Solving.
Known category → Classification. Known numerical value → Regression. No predefined groups → Clustering. Learning through actions and rewards → Reinforcement Learning.
Choose the Right Type
A company has customer data and wants to predict whether a customer will leave the service.
If the answer is Leave or Stay, this is classification.
Another company wants to predict the amount a customer will spend next month.
This is regression, because the answer is a numerical value.
Finally, a company has customer behavior data but no customer groups and wants to discover groups of similar customers.
This is clustering, because the groups need to be discovered from the data.