ML learning types, tasks and metrics

AIF-C01 · Fundamentals of AI and ML · Updated

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

TypeDataExample
SupervisedLabeledSpam detection, price prediction
UnsupervisedUnlabeledCustomer segmentation, anomaly detection
Semi-supervisedFew labels, many unlabeledLabeling a large image set cheaply
ReinforcementRewards and penaltiesGame 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

TaskMetrics
ClassificationAccuracy, precision, recall, F1, AUC-ROC, confusion matrix
RegressionMSE, 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.

AIF-C01 course outline

All 8 lessons · Course overview
  1. ML learning types, tasks and metricsFundamentals of AI and ML Free
  2. AWS AI services and SageMaker AI toolsFundamentals of AI and ML Free
  3. Generative AI, LLMs and inference parametersFundamentals of Generative AI Full access
  4. Amazon Bedrock, Amazon Q and model customizationFundamentals of Generative AI Full access
  5. Prompt engineering techniquesApplications of Foundation Models Full access
  6. Evaluating foundation model outputApplications of Foundation Models Full access
  7. Responsible AI principles and toolsGuidelines for Responsible AI Full access
  8. Securing AI workloads and AWS compliance toolsSecurity, Compliance, and Governance for AI Solutions Full access