What is a label in machine learning?
A label in machine learning is the known output or category attached to a training example that a supervised model learns to predict.
Labels provide the correct answer for the examples used during training.
Simple example
Suppose we are training a model to detect spam emails.
Each email might have a label such as:
- Spam
- Not spam
The model receives the email as input and learns to predict the correct label.
Email features → LabelLabels in classification
The term label is used most often in classification problems, where the output belongs to a category.
Examples include:
cat,dog, orbirdfor image classificationfraudornot fraudfor transaction detectionapprovedorrejectedfor an application
Label vs target variable
- A target variable is the general output a supervised model tries to predict.
- A label usually refers to a known categorical target assigned to an example.
In practice, the terms are sometimes used interchangeably, especially when discussing supervised learning.
Labeled data
A dataset is called labeled when its training examples include these known outputs.
For example:
Image → cat
Image → dog
Image → catHere, cat and dog are the labels.
In short, a label is the known answer attached to a training example that tells a supervised model what output it should learn to predict.
Learning Sequence
Machine Learning Curriculum
What is the difference between features and labels?
Explore Related Questions
Deepen your understanding across related Machine Learning topics.