Concept 3 of 5

Supervised, unsupervised and reinforcement learning

1 question test this

A model learns in one of three ways, and which one applies is decided by the data available and never by the outcome wanted. Supervised, unsupervised and reinforcement learning are the three, every machine learning syllabus opens with them, and both the AWS and the Google Cloud exam guides expect a candidate to describe each and to name the kinds of data that go with it. On the AI safety courses they matter because the safety properties of a system depend on how it was trained.

The sections below take the three in turn, describe the data underneath them and end with how to choose.

Supervised learning

The training data carries the answer. Each example has a label, and the model learns to predict that label for input it has not seen.

Two tasks sit underneath it. Classification predicts a category, such as whether a transaction is fraudulent or which of five topics a support ticket belongs to. Regression predicts a number, such as next month's demand or the price a property will fetch.

Supervised learning is the workhorse, and its constraint is labels. Labels are expensive, they are often produced by people who disagree with each other, and a model can never be better than the labels it learned from.

Unsupervised learning

The data has no labels and the model finds structure on its own. Clustering groups similar records without anybody naming the groups, which is how customer segments emerge from behaviour with nobody assuming them in advance. Dimensionality reduction compresses many variables into a few that carry most of the signal. Anomaly detection learns what normal looks like and flags what departs from it.

The catch is evaluation. With no ground truth, there is no accuracy figure, and judging whether the clusters mean anything is a human job.

A third arrangement sits between the two. Self supervised learning takes unlabelled data and manufactures a label from it, and predicting the next word in a sentence is the example that matters most, since it is how every large language model is pre trained. The text supplies its own answers, which is why such models can learn from the whole internet without anyone labelling any of it.

Reinforcement learning

An agent acts in an environment and receives rewards or penalties, and it learns a policy that maximises reward over time. There is no labelled dataset at all. There is a goal, a set of possible actions and feedback.

It suits sequential decisions where each choice changes what comes next, such as robotics, game playing or bidding. It reaches most readers through reinforcement learning from human feedback, the step where people rank model outputs and those rankings train a reward model that shapes a language model's behaviour.

The data underneath

Data is separated along two lines, and placing an example on both is the skill.

Labelled or unlabelled decides whether supervised learning is even available.

Structured or unstructured decides how it has to be handled. Structured data has a schema, which covers tabular records and time series where order carries meaning. Unstructured data does not, which covers text, images, audio and video, and is where deep learning earns its cost.

Choosing between them

The useful question is which technique the situation admits, and how powerful each one is comes second.

Where there are labelled examples of the thing to be predicted, supervised learning applies. Where there is data and no labels and the question is whether structure might be there, unsupervised learning applies. Where the problem is a sequence of decisions with delayed consequences, and a reward can be defined honestly, reinforcement learning applies.

And where the rule can be stated in a sentence, the rule is written. A model that learns something already known costs more and explains less.

Common misconceptions

“Clustering and classification are two words for sorting things into groups.”

Classification puts items into groups defined in advance from labelled examples. Clustering discovers groupings nobody named. Asking which one is needed is really asking whether there are labels.

“Unsupervised learning needs no data preparation because there are no labels.”

It needs no labels, which is a different thing. Feature scaling, missing values and outliers matter more in unsupervised learning, because there is no ground truth to reveal that the result is nonsense.

“Reinforcement learning is what makes a chatbot helpful.”

Reinforcement learning from human feedback is one step in aligning a language model, and it operates on a model that was already pre trained on text. The capability comes from the pre training. The reinforcement step shapes how that capability is expressed.

1 question test this concept

Supervised fine tuning follows pre training. What does it contribute?

  • AIt turns a text continuer into something that answers, by training on instructions paired with good responses.
  • BIt adds new knowledge that was absent from the pre training corpus.
  • CIt compresses the model so it can be served more cheaply.
  • DIt removes the model's ability to produce harmful content.
Check whether it stuck.

One per page, with a worked explanation.

Start the set
Related material
Book
Data Science for Business, On matching a business question to a learning task.
Book
Designing Machine Learning Systems, On what each learning type demands of your data pipeline.