Fundamentals of AI and ML · Topic 2 of 8
Learning Types and Data Types
Compare supervised, unsupervised and reinforcement learning, and the data types that feed them: labeled, unlabeled, structured and unstructured data.
- 4 min
- Supervised learning needs labeled data and predicts a category (classification) or a number (regression).
- Unsupervised learning uses unlabeled data to find groups or unusual items, for example clustering and anomaly detection.
- Reinforcement learning trains an agent by rewards and penalties through trial and error.
What it is
Machine learning methods are grouped by how the model learns. The three families are supervised learning, unsupervised learning and reinforcement learning.
The right family depends on whether you have the correct answers for your data, and on what you want the model to produce. The data itself also comes in different types, and the type affects which methods and services fit.
How it works
Supervised learning
In supervised learning, every training example has a label. The model learns the link between the inputs and the label, then predicts the label for new inputs. There are two main tasks.
| Task | Output | Example |
|---|---|---|
| Classification | A category | Is this email spam or not spam |
| Regression | A number | What will this house sell for |
Binary classification has two classes, while multiclass classification has more than two. Supervised learning is the most common choice when you have past records with known outcomes.
Unsupervised learning
Unsupervised learning has no labels. The model looks for structure in the data on its own.
Common tasks include clustering, which groups similar items together, and anomaly detection, which finds items that do not fit the usual pattern. A typical business use is grouping customers into segments without deciding the segments in advance.
Reinforcement learning
In reinforcement learning, an agent takes actions in an environment and receives rewards or penalties. Over many tries it learns a strategy that earns the most reward.
It suits sequential decision problems such as game playing, robot control and some resource planning. Reinforcement learning from human feedback (RLHF) is also used to align language models with human preferences, which you will meet in the foundation model chapters.
Semi supervised learning
Semi supervised learning mixes a small amount of labeled data with a large amount of unlabeled data. It helps when labeling is slow or costly.
Types of data
| Data type | Meaning | Example |
|---|---|---|
| Labeled | Each record includes the correct answer | Photos tagged cat or dog |
| Unlabeled | Records have no answer attached | A folder of untagged photos |
| Structured | Organised in rows and columns | A sales table in a database |
| Unstructured | No fixed format | Emails, images, audio, video |
| Tabular | Structured data laid out as a table | A customer spreadsheet |
| Time series | Values recorded over time in order | Daily website visits |
| Text | Written language | Support tickets |
| Image | Pixels in pictures | X ray scans |
Structured data is simple to query and analyse, while unstructured data needs extra processing before a model can use it. Deep learning is strong on unstructured data, and classic ML often does well on tabular data.
Labeling and data quality
Labels are often produced by people, which takes time and money. Amazon SageMaker Ground Truth is the AWS service that helps with building labeled datasets, using human labelers and automation. Whatever the source, labels must be correct, because a model learns whatever the labels teach it.
Choosing quickly
What to remember for the exam
- Supervised learning needs labeled data and predicts a category (classification) or a number (regression).
- Unsupervised learning uses unlabeled data to find groups or unusual items, for example clustering and anomaly detection.
- Reinforcement learning trains an agent by rewards and penalties through trial and error.
- Semi supervised learning combines a little labeled data with a lot of unlabeled data.
- Structured data fits rows and columns, and unstructured data covers text, images, audio and video.
- Time series data is ordered by time and is typical for forecasting.
- Amazon SageMaker Ground Truth helps create labeled training data.
- Good labels matter, since a model copies the patterns in whatever it is taught.
Look for the output in the question. A category points to classification, a number points to regression, and "groups with no predefined labels" points to clustering.
Common mistakes
Calling regression a type of classification. Regression predicts a continuous number, such as a price. Classification predicts a class, such as approve or decline.
Picking supervised learning when there are no labels. If nobody has recorded the correct answers, supervised learning is not possible without labeling first. Clustering is the usual fit.
Mistaking a probability score for regression. A model that outputs the chance of fraud and then labels each case fraud or not fraud is still doing classification.
Treating reinforcement learning as a labeled data method. It does not need labeled examples. It needs an environment that returns rewards.
Assuming unstructured data cannot be used. It can, but it needs extra steps such as text processing or image processing, or a deep learning model built for it.
Check yourself
Which learning type needs labeled data?
Supervised learning, because it learns from examples with known answers.
A retailer wants to group customers into segments without predefined groups. Which approach fits?
Unsupervised learning, specifically clustering.
What kind of task is predicting next month's sales figure?
It is a regression task, since the output is a number.
Topic 2 of 8 in Fundamentals of AI and ML
Test yourself on Fundamentals of AI and ML
The full AWS AIF-C01 question bank has 849 questions, with timed practice exams and an explanation for every answer.
This study guide is independent and is not affiliated with, endorsed by, or sponsored by AWS. Vendor names, certification names and exam codes are trademarks of their respective owners and are used for identification only.