Classification
Supervised learning connects inputs with known targets through a collection of examples.
From Examples to Predictions
Suppose a learning system receives many inputs, and every input arrives with the answer it is expected to learn. This pairing is the starting point for supervised learning. The system studies the examples, discovers a mapping from inputs to known targets, and then uses that mapping to produce a prediction for a new input.
Supervised Learning Structure
A supervised-learning collection contains examples. Each example has an input and a known target. The target is also called an annotation. The learner uses the paired examples to discover a reusable relationship between inputs and targets. After learning, a new input can be passed through that relationship to produce a prediction.
Tracing a Labeled Example
Identify the roles of the review text, sentiment answer, and learned relationship in a supervised-learning example.
Input: The review text is the input data presented to the learning system.
Known target: The accompanying sentiment answer is the known target that the system is expected to learn.
Collection of examples: Many input-and-target pairings provide the examples from which the system learns.
Prediction: After learning, the resulting input-to-target mapping can be used with a new review text.
Supervised learning changes a collection of labeled examples into a reusable mapping from inputs to targets.
Target Shape Determines the Task
The target does not have to be one category. Its structure determines the supervised-learning task. A target may be a category, a numerical quantity, an ordered sequence, a tree-shaped structure, object locations, or a pixel-level mask.
| Task | Target form | What the target describes |
|---|---|---|
| Classification | Category | Which class an input belongs to |
| Sequence generation | Ordered sequence | A complete ordered output such as a caption |
| Syntax tree prediction | Nested structure | The structure of a sentence |
| Object detection | Objects and bounding boxes | Which objects appear and where their boxes are |
| Image segmentation | Pixel-level mask | The pixels belonging to a specific object |
Different target structures create different supervised-learning tasks.
Sequence generation predicts an ordered output, such as a caption. It can also be understood as repeated classification: the system repeatedly chooses the next word or token, one element at a time. Object detection identifies objects together with bounding boxes. It can involve classifying candidate boxes, or classifying and predicting box coordinates through vector regression. Image segmentation is more precise because its target is a mask marking the pixels of a specific object. Syntax tree prediction uses a target that describes the nested structure of a sentence.
Two-Class Decisions
Binary classification is a machine-learning problem with two possible classes.
In a binary-classification problem, the model must select between exactly two outcomes. The two outcomes are the classes. In the IMDB movie-review task, those classes are positive sentiment and negative sentiment.
The IMDB Review Task
The IMDB example applies binary classification to movie reviews. The relevant input is the text content of a review. The possible targets are positive and negative sentiment. The IMDB dataset supplies the dataset context for this task, so many movie-review examples can be used as the basis for learning the relationship between review text and sentiment.
Classifying an IMDB Review
Describe the supervised-learning roles in the IMDB movie-review binary-classification example.
Choose the input: Use the text content of the movie review as the input.
Choose the target space: The target has two possible classes: positive sentiment and negative sentiment.
Use the dataset: The IMDB dataset provides the movie-review dataset context for learning this task.
Learn the relationship: The system uses examples to connect review text with its known sentiment target.
Classify a review: For a review presented as a new input, the learned relationship produces either the positive or negative class.
The IMDB task is supervised binary classification because review text is mapped to one of two known sentiment classes.
Common Classification Mistakes
Treating every supervised-learning target as a single category.
Supervised learning supports targets with many forms, including sequences, trees, boxes, and masks.
Fix:
Inspect the structure of the target before naming the task.Calling the IMDB task multi-class classification.
The IMDB example described here has two outcomes: positive and negative.
Fix:
Identify it as binary classification.Using the dataset name as the prediction target.
IMDB is the dataset context; the prediction concerns the sentiment of a movie review.
Fix:
Separate the dataset from the input and target: review text is the input, and positive or negative sentiment is the target.Ignoring the review text.
The text content of the review is the basis for the classification.
Fix:
State that the review text is mapped to a sentiment class.
Check Your Understanding
A learning task receives examples in which each input is paired with a known target. In one version, the target is an ordered caption. In another, the target is a pixel-level mask for an object. Explain why both tasks are supervised learning, and identify how their target forms differ.
Hints
- Begin with the shared input-and-known-target structure.
- Compare an ordered output with a pixel-level mask.
Classify the IMDB movie-review example using these three labels: input, target, and dataset. Then state why the task is binary classification.
Hints
- The input is the information contained in the review.
- The target has exactly two possible sentiment outcomes.
- The dataset names the collection context.
Key Takeaways
- Supervised learning connects inputs with known targets through a collection of examples.
- The target structure determines the task: it may be a category, sequence, tree, bounding-box description, or pixel-level mask.
- Sequence generation can be viewed as repeated classification of the next word or token.
- Binary classification has exactly two possible classes.
- In the IMDB example, review text is classified as positive or negative sentiment, and the IMDB dataset provides the movie-review dataset context.
Key Takeaways
- Supervised learning learns from inputs paired with known targets.
- Different target forms lead to different supervised-learning tasks.
- Binary classification chooses between exactly two classes.
- The IMDB movie-review task maps review text to positive or negative sentiment.
- The IMDB dataset supplies the collection of movie-review examples used in that task.