Concepts / Classification Problems

Classification Problems

A class is a category in a classification problem.

  • Programming

Start with One Data Point

Classification terminology becomes easier when you begin with one data point instead of an entire dataset. Imagine one item being considered in a classification problem. That item is a sample. The category it belongs to is a class. The class associated with that particular sample is its label.

S1sampleClass Alabelhas label
How does a label connect one specific data point to the category it belongs to?
Key point

A label is not a general description of all categories. It is the class associated with one specific sample.

Three Terms to Separate

TermMeaningRole in a classification problem
SampleAn individual data pointThe particular item being considered
ClassA categoryA category used in the classification problem
LabelThe class associated with a specific sampleThe connection between one sample and its category

The three terms describe different parts of the same classification relationship.

The distinction is based on what each term refers to. A sample refers to an individual data point. A class refers to a category. A label refers to the category assigned to a particular sample. Therefore, the same class can be a label for more than one sample.

S1sampleClass AcategoryS2sampleClass BcategoryS3samplelabellabellabel
How do multiple individual data points relate to the categories used to group them?

Trace the Assignments

Worked example

Following S1, S2, and S3

Suppose the classification categories are Class A and Class B. S1 is associated with Class A, S2 is associated with Class B, and S3 is also associated with Class A.

  1. 1
    S1

    S1 is an individual data point, so S1 is a sample. Because S1 is associated with Class A, Class A is the label for S1.

  2. 2
    S2

    S2 is another individual data point, so S2 is a sample. Its associated class is Class B, making Class B the label for S2.

  3. 3
    S3

    S3 is also a sample. It is associated with Class A, so Class A is the label for S3 as well.

  4. 4
    Compare the labels

    Class A is the label for both S1 and S3. This shows that the same class can serve as the label for multiple samples.

Result

S1 has label Class A, S2 has label Class B, and S3 has label Class A.

Class A and Class Bpossible classesS1sampleClass Alabel for S1has label
What is the difference between the full collection of possible categories and the single category assigned to one sample?

Follow the Classification Relationship

A classification problem can be understood by following the relationship from an individual sample to the category associated with it. Start with the sample, identify the class connected to that sample, and use that associated class as the sample's label. The label describes the class connection for that particular sample.

Sampleindividual data pointAssociated classcategoryLabelclass for that sampleconsiderbecomes
How does a classification problem connect each sample to an associated category?
Key point

The relationship is specific to a sample: first identify the sample, then identify its associated class, and finally describe that associated class as the sample's label.

Mistakes Beginners Make

  • Common mistake

    Calling the sample a class

    What it looks like

    Treating S1 as a category rather than as an individual data point.

    Why it fails

    A sample is an individual data point. A class is a category.

    Do this instead

    Describe S1 as a sample and the category associated with S1 as its class or label.

  • Common mistake

    Calling the full collection of categories one sample's label

    What it looks like

    Saying that the label for S1 is Class A and Class B together.

    Why it fails

    A label is the class associated with one specific sample.

    Do this instead

    If S1 is associated with Class A, say that Class A is the label for S1.

  • Common mistake

    Assuming a class can label only one sample

    What it looks like

    Saying that Class A cannot be the label for S3 because it already labels S1.

    Why it fails

    The same class can serve as the label for multiple samples.

    Do this instead

    Allow multiple samples to have the same class as their label, as S1 and S3 both have Class A in the example.

Check Your Understanding

EASY

A classification problem uses Class A and Class B. S4 is an individual data point associated with Class B. Identify the sample, the class, and the label for S4.

Hints
  • An individual data point is a sample.
  • The category associated with the sample is its label.
  • The class and the label have the same category name for this particular sample.
Worked example

Practice Answer

A classification problem uses Class A and Class B. S4 is an individual data point associated with Class B.

  1. 1
    Identify the sample

    S4 is the individual data point, so S4 is the sample.

  2. 2
    Identify the class

    Class B is a category in the classification problem, so Class B is the class associated with S4.

  3. 3
    Identify the label

    Because Class B is associated with S4, Class B is the label for S4.

Result

The sample is S4, the class is Class B, and the label for S4 is Class B.

Key Takeaways

  1. 1
    A sample is an individual data point.
  2. 2
    A class is a category in a classification problem.
  3. 3
    A label is the class associated with one specific sample.
  4. 4
    The collection of possible classes is different from the single class assigned as a sample's label.
  5. 5
    The same class can be the label for multiple samples.

At a glance

  • A sample is an individual data point.
  • A class is a category used in a classification problem.
  • A label connects one specific sample to its associated class.
  • The full collection of categories is not the same as the label for one sample.
  • One class can serve as the label for multiple samples.

Related concepts

More concepts starting with C