Concepts / Classification

Classification

In a binary-classification problem, the model must select between exactly two outcomes.

  • Programming

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.

Input example 1input dataInput-to-targetmappinglearned modelNew inputunseen dataKnown target 1annotationPredictionproduced targetInput example 2input dataKnown target 2annotationpaired exampleknown answerpaired exampleknown answerpresented toproduces
How are input examples paired with their known target labels to train a supervised-learning model?

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.

Worked example

Tracing a Labeled Example

Identify the roles of the review text, sentiment answer, and learned relationship in a supervised-learning example.

  1. 1
    Input

    The review text is the input data presented to the learning system.

  2. 2
    Known target

    The accompanying sentiment answer is the known target that the system is expected to learn.

  3. 3
    Collection of examples

    Many input-and-target pairings provide the examples from which the system learns.

  4. 4
    Prediction

    After learning, the resulting input-to-target mapping can be used with a new review text.

Result

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.

ClassificationcategorySequence generationordered outputObject detectionobjects and boxesSyntax treepredictionnested sentence structureImage segmentationpixel masktarget is a categorytarget is orderedtarget has boxestarget is nestedtarget marks pixels
How does the form of the target determine whether a task is classification, sequence generation, object detection, syntax tree prediction, or image segmentation?
TaskTarget formWhat the target describes
ClassificationCategoryWhich class an input belongs to
Sequence generationOrdered sequenceA complete ordered output such as a caption
Syntax tree predictionNested structureThe structure of a sentence
Object detectionObjects and bounding boxesWhich objects appear and where their boxes are
Image segmentationPixel-level maskThe 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

Definition

Binary classification is a machine-learning problem with two possible classes.

Movie reviewtext contentClassificationtwo possible classesPositivesentiment classNegativesentiment classtext used as inputone outcomeone outcome
How does a model choose between exactly two possible classes, and how are positive and negative sentiment represented?

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.

Review textinputText-to-sentimentmappinglearned relationshipPositiveclassIMDB datasetcollection of examplesNegativeclassappears inprovides examplesinput relationshippredicts one classpredicts one class
How does the text content of a movie review become an input that is mapped to a positive or negative sentiment?
Worked example

Classifying an IMDB Review

Describe the supervised-learning roles in the IMDB movie-review binary-classification example.

  1. 1
    Choose the input

    Use the text content of the movie review as the input.

  2. 2
    Choose the target space

    The target has two possible classes: positive sentiment and negative sentiment.

  3. 3
    Use the dataset

    The IMDB dataset provides the movie-review dataset context for learning this task.

  4. 4
    Learn the relationship

    The system uses examples to connect review text with its known sentiment target.

  5. 5
    Classify a review

    For a review presented as a new input, the learned relationship produces either the positive or negative class.

Result

The IMDB task is supervised binary classification because review text is mapped to one of two known sentiment classes.

Common Classification Mistakes

  • Common mistake

    Treating every supervised-learning target as a single category.

    What it looks like

    Describing a caption, a syntax structure, or a pixel mask as though it were only one class.

    Why it fails

    Supervised learning supports targets with many forms, including sequences, trees, boxes, and masks.

    Do this instead

    Inspect the structure of the target before naming the task.

  • Common mistake

    Calling the IMDB task multi-class classification.

    What it looks like

    Assuming that a review can receive many sentiment classes in the example.

    Why it fails

    The IMDB example described here has two outcomes: positive and negative.

    Do this instead

    Identify it as binary classification.

  • Common mistake

    Using the dataset name as the prediction target.

    What it looks like

    Saying that the model predicts IMDB.

    Why it fails

    IMDB is the dataset context; the prediction concerns the sentiment of a movie review.

    Do this instead

    Separate the dataset from the input and target: review text is the input, and positive or negative sentiment is the target.

  • Common mistake

    Ignoring the review text.

    What it looks like

    Describing the sentiment class without identifying what information is used to make the classification.

    Why it fails

    The text content of the review is the basis for the classification.

    Do this instead

    State that the review text is mapped to a sentiment class.

Check Your Understanding

MEDIUM

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.
EASY

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

  1. 1
    Supervised learning connects inputs with known targets through a collection of examples.
  2. 2
    The target structure determines the task: it may be a category, sequence, tree, bounding-box description, or pixel-level mask.
  3. 3
    Sequence generation can be viewed as repeated classification of the next word or token.
  4. 4
    Binary classification has exactly two possible classes.
  5. 5
    In the IMDB example, review text is classified as positive or negative sentiment, and the IMDB dataset provides the movie-review dataset context.

At a glance

  • 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.

Related concepts

More concepts starting with C