Machine learning is about finding patterns in data instead of writing every rule by hand. The two main approaches differ in one thing: whether the training data comes with the right answers.
Supervised learning
The model learns from labeled examples, inputs paired with the correct output, and then predicts outputs for new inputs.
- Classification predicts a category, such as spam or not spam.
- Regression predicts a number, such as a house price.
Labels are often the expensive part, because people have to create them.
Unsupervised learning
The model gets data without labels and looks for structure on its own.
- Clustering groups similar items, such as customers with similar buying habits.
- Dimensionality reduction compresses data while keeping what matters, useful for visualization.
- Anomaly detection flags unusual events, such as a strange login or a faulty sensor.
Where large language models fit
Large language models start with self-supervised learning: they predict the next word across huge amounts of text, so the data provides its own labels. They are then fine-tuned with supervised examples and human feedback to follow instructions.
A worked example: predicting house prices
Say you have records of 5,000 homes that sold last year, each with its size, number of bedrooms, neighborhood, age and final sale price. The sale price is the label. A supervised model, even a simple linear regression, learns how each feature tends to push the price up or down. Give it a new listing without a price and it estimates one.
The important habit is to hold some data back. You train on, say, 80% of the homes and test on the remaining 20% the model has never seen. If it does well on the training homes but badly on the test homes, it has memorized rather than learned, a problem called overfitting.
A worked example: grouping customers
Now take an online store’s purchase history with no labels at all: just what each customer bought, how often and how much they spent. A clustering algorithm such as k-means groups customers whose behavior looks similar. The output might reveal a cluster of frequent small buyers, a cluster of rare big spenders and a cluster of people who only buy during sales.
The algorithm doesn’t name these groups. A person has to look at each cluster and decide what it means, and whether it is useful. That interpretation step is typical of unsupervised learning.
The space in between
Two other approaches are worth knowing by name:
- Semi-supervised learning uses a small labeled set together with a large unlabeled one, useful when labeling everything is too expensive, such as medical images that need an expert.
- Reinforcement learning learns by trial and error from rewards rather than labels. It is how systems learn to play games or control robots, and a variant using human ratings helps tune chatbots.
How to choose
If you have labeled data and a clear target to predict, use supervised learning. If you want to explore data or have no labels, start with unsupervised methods. Many real projects do both: clustering first to understand the data, then a supervised model once you know what to predict.
Whichever you pick, the quality of the data matters more than the cleverness of the algorithm. Biased, outdated or mislabeled examples produce a model that is confidently wrong, so spend time checking the data before tuning the model.
What we think
The distinction between supervised and unsupervised learning is less about algorithms than about data. Labeled examples let you predict a specific outcome; unlabeled data lets you discover structure you didn’t know to look for.
For anyone starting a machine learning project, the most useful question is not which technique is more advanced but what data you actually have and what decision you want it to support. Clean, representative data with a clear target beats a sophisticated model trained on the wrong examples.