Machine Learning Data Terminology
A class is a category in a classification problem.
Start with One Item
Classification terminology becomes easier when you begin with one data point instead of a whole 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.
The basic relationship is sample → label → class: a sample is the individual data point, and its label identifies the class associated with it.
Trace One Sample
In this relationship, S1 is the sample because it is one individual data point. Class A is a class because it is a category in the classification problem. Because Class A is associated with S1, Class A is the label for S1. The word label describes the association from the perspective of that particular sample.
Class Versus Label
A class is a category in a classification problem. A sample is an individual data point. A label is the class associated with a specific sample.
Class and label can refer to the same category name, but they answer different questions. Class asks, “What category exists in the classification problem?” Label asks, “Which class is associated with this particular sample?” Therefore, Class A can be a class in general, and it can also be the label for S1 when S1 is associated with Class A.
| Term | Meaning | Focus |
|---|---|---|
| Sample | An individual data point | One item being considered |
| Class | A category in a classification problem | A category available in the problem |
| Label | The class associated with a specific sample | The category assigned to one item |
The terms describe different parts of a classification relationship.
All Categories and One Assignment
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 associated with Class A.
Step 1: 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.
Step 2: S2 is another sample. Because S2 is associated with Class B, Class B is the label for S2.
Step 3: S3 is also a sample. It may have Class A as its label, showing that the same class can be associated with more than one sample.
Step 4: Class A and Class B are the categories used in the classification problem. The label for an individual sample is one class associated with that specific sample.
The available classes are Class A and Class B. The labels are Class A for S1, Class B for S2, and Class A for S3.
A classification problem can have multiple classes, while one specific sample has its own associated label. The same class can be the label for multiple samples.
Mistakes to Avoid
Treating a sample as a category
S1 is one individual data point, so it is a sample. A class is a category.
Fix:
Describe S1 as a sample and identify the class associated with it as its label.Treating the whole collection of classes as one sample's label
The label is the class associated with one specific sample, not the complete collection of categories.
Fix:
For S1, name the one associated class. In the source example, Class A is the label for S1.Assuming a class can label only one sample
The same class can be associated with more than one sample.
Fix:
Allow multiple samples to have the same class as their label.
Check Your Understanding
A classification problem uses Class A and Class B. S1 is associated with Class B, while S2 and S3 are associated with Class A. Identify the samples, the classes, and the label for each sample.
Hints
- A sample is an individual data point.
- The classes are the categories used in the classification problem.
- For each sample, its label is the class associated with that particular sample.
What do you think happens?
If S1 and S3 are both associated with Class A, can Class A be the label for both samples?
Reveal answer
Answer: Yes
The same class can serve as the label for multiple samples.
Terminology Summary
- A sample is an individual data point.
- A class is a category in a classification problem.
- A label is the class associated with a specific sample.
- The collection of classes describes the categories used by the classification problem, while a label identifies the category associated with one sample.
- The same class can be the label for multiple samples.
Key Takeaways
- A sample is one individual data point.
- A class is a category in a classification problem.
- A label connects one specific sample to the class associated with it.
- A classification problem may use several classes, but each sample is considered through its associated label.
- One class can serve as the label for multiple samples.