Machine learning methods are usually grouped into three families: supervised, unsupervised and reinforcement learning. The difference is mostly about what kind of feedback the algorithm receives while learning. Once you know that, choosing an approach for a real problem becomes much easier.
Supervised learning: learning from labelled examples
In supervised learning, every training example comes with the correct answer, called a label. The algorithm learns the mapping from input to label, then predicts labels for new inputs.
There are two main task types.
- Classification: predict a category. Examples: spam or not spam, disease present or absent, which digit is in an image.
- Regression: predict a number. Examples: house price, tomorrow's demand, delivery time.
Common algorithms: linear and logistic regression, decision trees, random forests, gradient boosting, support vector machines and neural networks.
Strength: it is accurate and easy to evaluate because you can compare predictions to known answers. Weakness: labelled data can be expensive and slow to collect.
Unsupervised learning: finding structure without labels
In unsupervised learning, there are no correct answers provided. The algorithm explores the data to find hidden structure.
Common tasks:
- Clustering: group similar items, such as customers with similar buying habits.
- Dimensionality reduction: compress many features into fewer while keeping important information, useful for visualisation.
- Anomaly detection: find items that look unusual compared to the rest.
Common algorithms: k-means, hierarchical clustering, DBSCAN and PCA.
Strength: works with plentiful unlabelled data. Weakness: results are harder to judge, since there is no ground truth. You must interpret whether the groups make sense.
Reinforcement learning: learning by trial and reward
In reinforcement learning (RL), an agent interacts with an environment, takes actions and receives rewards or penalties. Its goal is to learn a strategy, called a policy, that maximises total reward over time.
Examples:
- Game-playing systems that learn by playing millions of games
- Robots learning to walk or grasp
- Systems that decide how to allocate resources or schedule tasks
Strength: can learn complex sequential decisions without labelled examples. Weakness: often needs huge numbers of trials, a well-designed reward and a safe simulation, because bad actions in the real world can be costly.
Comparison table
| Supervised | Unsupervised | Reinforcement | |
|---|---|---|---|
| Feedback | Correct labels | None | Rewards and penalties |
| Goal | Predict labels | Discover structure | Maximise long-term reward |
| Data | Labelled | Unlabelled | Interaction with environment |
| Example | Spam detection | Customer segmentation | Game-playing agent |
A short Python example
The following uses scikit-learn to show supervised and unsupervised learning on the same data.
from sklearn.datasets import load_iris
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LogisticRegression
from sklearn.cluster import KMeans
X, y = load_iris(return_X_y=True)
# Supervised: use labels y
X_tr, X_te, y_tr, y_te = train_test_split(X, y, test_size=0.3, random_state=0)
clf = LogisticRegression(max_iter=200).fit(X_tr, y_tr)
print("Supervised accuracy:", clf.score(X_te, y_te))
# Unsupervised: ignore labels, ask for 3 clusters
km = KMeans(n_clusters=3, n_init="auto", random_state=0).fit(X)
print("Cluster sizes:", [int((km.labels_ == k).sum()) for k in range(3)])
The first model is told the right answers. The second never sees them and groups flowers by similarity alone.
How each type is evaluated
- Supervised: compare predictions with known labels on data held back from training. Typical measures are accuracy, precision, recall and error size for numbers.
- Unsupervised: there is no answer key, so you check whether clusters are stable, well separated and, most importantly, meaningful to people who know the business.
- Reinforcement: you track the total reward the agent collects over many episodes, and test it in situations it did not train on.
Mixing up these evaluation styles is a common beginner error. A clustering result cannot have "accuracy" in the usual sense because no label exists to compare against.
Other approaches you may hear about
- Semi-supervised learning: a small labelled set plus a large unlabelled set.
- Self-supervised learning: the data creates its own labels, for example predicting the next word in a sentence. This is how large language models are pretrained.
- Transfer learning: reusing a model trained on one task for another.
How to choose
- Do you have labelled examples of the outcome you want? Use supervised learning.
- Do you just want to understand or group your data? Try unsupervised methods.
- Are you making a series of decisions where actions change the situation? Consider reinforcement learning, or first check whether simpler rules would do.
Frequently Asked Questions
Which type is most common in business?
Supervised learning is the most widely used, for forecasting, scoring and classification, because business problems often have historical records with known outcomes.
Can I combine these types?
Yes. For example, cluster customers first, then train a supervised model per segment, or use self-supervised pretraining followed by supervised fine-tuning.
Is reinforcement learning used in chatbots?
Some language models use reinforcement learning from human feedback to make answers more helpful, though pretraining is mainly self-supervised.
Do I always need lots of data?
More data generally helps, but for many tabular problems a few thousand good examples are enough to start with simple models.
Conclusion
Supervised learning predicts known targets, unsupervised learning discovers patterns, and reinforcement learning learns from rewards. Match the method to your data and goal, and start with the simplest approach that could work.