The first question in any machine learning project is: do we have the answers for past examples? That decides whether the problem is supervised or unsupervised.
Supervised learning: learning from labelled examples
You have inputs and the known correct output for past cases, and the model learns to map one to the other.
Regression: predict a number
- Delivery time of a food order.
- Price of a used car.
- Next month's demand for a product.
Algorithms: linear regression, decision tree and random forest regressors, KNN regression.
Classification: predict a category
- Will this loan applicant default?
- Is this message spam?
- Which team should handle this support ticket?
Algorithms: logistic regression, decision trees, random forests, Naive Bayes, SVM, KNN.
What you need
Historical data with reliable labels. Getting labels is often the hardest part: someone must have recorded which loans defaulted or which tickets went to which team.
Unsupervised learning: finding structure without labels
You only have inputs, and the goal is to discover patterns.
Clustering: group similar items
- Customer segments for marketing.
- Grouping stores with similar sales patterns.
- Finding natural groups of products bought together.
Algorithm: K-Means is the usual starting point.
Dimensionality reduction: simplify many columns
- Summarising a long survey into a few scores.
- Visualising high-dimensional data in two dimensions.
- Reducing noise before another model.
Algorithm: PCA.
Anomaly detection
Spotting unusual transactions or sensor readings when you have few labelled examples of problems.
Side by side
| Supervised | Unsupervised | |
|---|---|---|
| Labels needed | Yes | No |
| Goal | Predict a known target | Discover structure |
| Evaluation | Compare with true answers | Harder: business sense, stability, internal scores |
| Examples | Default risk, churn, price | Segments, survey scores, anomalies |
How they work together
- Segment, then predict: cluster customers, then build a churn model per segment or use the segment as a feature.
- Reduce, then cluster: use PCA to compress features, then K-Means on the components.
- Label from clusters: analysts review clusters and turn them into categories that later become labels for a supervised model.
Semi-supervised and reinforcement learning (briefly)
Semi-supervised learning uses a few labels plus many unlabelled examples. Reinforcement learning learns by trial and reward, as in game-playing or some recommendation systems. Neither is usually expected from fresher analysts.
Learn both
Start supervised with logistic regression, then unsupervised with K-Means and PCA. The full list of lessons, playgrounds and practice sets is on the ML section of the practice page.
Practise what you just read
Reading helps; writing the code yourself is what sticks. Start here: