Machine Learning Fundamentals interview question · Most asked
What is the difference between supervised, unsupervised and reinforcement learning?
Comparison Asked in Machine Learning Engineer interviews
Summary
Supervised learning trains on labelled examples to predict a target (price, spam or not). Unsupervised learning finds structure in unlabelled data (clusters, lower-dimensional representations, anomalies). Reinforcement learning trains an agent through trial and error to maximise a reward over time.
Longer Answer
- Supervised: regression (continuous target) and classification (categories). Needs labels, which are often the expensive part.
- Unsupervised: k-means, DBSCAN, PCA, autoencoders, anomaly detection. Used for exploration, segmentation and as features for supervised models.
- Self-supervised learning (how large language models are pre-trained) creates labels from the data itself, such as predicting the next token.
- Reinforcement learning: an environment, actions, rewards and a policy; used for games, robotics, recommendation and fine-tuning language models from human feedback (RLHF).
Key Points
- Supervised: labels, predict a target.
- Unsupervised: structure without labels.
- Reinforcement: rewards from actions over time.
- Self-supervised pre-training underlies LLMs.
Explanation
What interviewers look for
Clear distinctions with a realistic example of each, and knowing where self-supervised learning fits.
More Machine Learning Fundamentals questions
- What is overfitting, and how do you prevent it?
- Your model scored well offline but performs badly in production. What do you check?
- What is data leakage, and how do you detect it?
- Which metrics would you use for a classification model, and when is accuracy misleading?
- How do you split data for training, validation and testing, and what is cross-validation?
- Explain the bias-variance trade-off.
- Compare decision trees, random forests and gradient boosting.
- Design a system that serves predictions from a trained model to a web application.