ML learning types, tasks and metrics
AI practitioners must choose the right kind of ML for a business problem and read basic quality metrics. This is the base of the whole exam.
AI, ML and deep learning
AI is the broad goal of machines doing tasks that need intelligence. Machine learning (ML) is a subset that learns patterns from data. Deep learning is a subset of ML that uses multi-layer neural networks. Generative AI is deep learning that creates new content.
Learning types
| Type | Data | Example |
|---|---|---|
| Supervised | Labeled | Spam detection, price prediction |
| Unsupervised | Unlabeled | Customer segmentation, anomaly detection |
| Semi-supervised | Few labels, many unlabeled | Labeling a large image set cheaply |
| Reinforcement | Rewards and penalties | Game playing, robotics |
Self-supervised learning creates its own labels from the data, for example predicting the next word. This is how foundation models are pre-trained.
Task types
- Classification: predict a category (churn yes or no, sentiment positive, neutral or negative).
- Regression: predict a number (demand, price).
- Clustering: group similar items without labels.
Fit problems
- Overfitting: memorizes training data, fails on new data. Low bias, high variance. Fix with more data, regularization, a simpler model, early stopping.
- Underfitting: too simple, poor on both. High bias. Fix with more features or a more complex model.
Data is usually split into training, validation and test sets. The test set is only used at the end.
Metrics
| Task | Metrics |
|---|---|
| Classification | Accuracy, precision, recall, F1, AUC-ROC, confusion matrix |
| Regression | MSE, RMSE, MAE, R-squared |
Precision asks “of the positives I predicted, how many were right?” Recall asks “of the real positives, how many did I find?” F1 balances both and helps with imbalanced classes. For fraud or disease detection, missing a real case is costly, so recall matters.
Inference types
Real-time inference answers one request at a time with low latency. Batch inference scores a large dataset on a schedule, such as once a day. Asynchronous inference handles large payloads or long processing. Serverless inference suits intermittent traffic without managing servers.
Exam traps
- Clustering is unsupervised; classification is supervised. “Group” means clustering, “predict a category” means classification.
- Accuracy can mislead on imbalanced data; prefer F1, precision or recall.
- Regression error metrics (MSE, RMSE) do not apply to classification.
- High training score plus low new-data score is overfitting, not underfitting.
- Decision trees and linear models are easier to explain than neural networks.
Practice questions
Choose an answer, then review the explanation to check your understanding.
1. An online shop wants to group customers by purchase history without any predefined labels. Which technique fits?
Show answer
Answer: B.Grouping unlabeled data is clustering, a form of unsupervised learning.
2. A model scores very high on training data but poorly on new data. What is the most likely cause and fix?
Show answer
Answer: B.Good training results with poor results on unseen data is overfitting. Regularization, simpler models and more data reduce it.
3. Which metric suits a model that predicts the price of a house?
Show answer
Answer: C.House price is a continuous value (regression), so an error metric such as RMSE or MSE applies. F1, accuracy and AUC are for classification.
4. A robot learns to move through a warehouse by receiving a reward for each successful delivery. Which learning type is this?
Show answer
Answer: C.Learning from rewards and penalties through trial and error is reinforcement learning.