TechByteByByte

Label

The correct answer attached to a training example — the thing a supervised model is actually trying to learn to predict.

#label#supervised-learning#dataset#core-ml-foundations

Imagine a teacher showing a student a question and its correct answer.

The student can compare their own answer with the correct one and learn from any mistake.

Machine Learning uses the same basic idea. Each training example can include the correct answer that the model should learn to predict. That correct answer is called a label.

The simple definition

A label is the correct answer attached to a training example — the thing the model is trying to learn to predict. Recall from the Feature article that a training example is made up of individual measurable pieces of information the model is given. A label is the other half of that example: the known, correct outcome that goes along with those features, used to teach the model what it should have predicted.

Take the house price example from the Feature article. The features were things like square footage, bedrooms, and neighborhood. The label is the actual, known sale price of that house — the number the model is ultimately trying to learn to predict from the features alone.

Features and label in one row

Hours studiedPractice testsAttendancePassed exam
6492%Yes

For a pass-prediction task:

Features: hours, tests, attendance
Label:    passed exam = Yes

The distinction depends on the task. If the task changes to predicting attendance, attendance may become the label instead of a feature.

How the label guides training

flowchart LR
    A[Features from one example] --> B[Model prediction]
    B --> C[Compare prediction with label]
    C --> D[Measure error]
    D --> E[Adjust model]

Without the label, supervised training cannot directly measure whether that prediction matched the expected answer.

Labels for different tasks

TaskExample label
Spam detectionspam or not spam
House-price prediction₹75 lakh
Object detectionObject category and bounding-box coordinates
Sentiment analysispositive, neutral, or negative
Medical-image classificationDiagnosis confirmed by an appropriate expert process

A label can therefore be a category, number, location, sequence, or another structured answer.

Where labels come from

Labels may come from human annotators, subject-matter experts, existing business outcomes, sensors, controlled measurements, user behavior, or rules that generate approximate labels.

Human labels are not automatically perfect. People may disagree, misunderstand instructions, make mistakes, or apply personal bias. High-impact domains often require clear guidelines, multiple reviewers, disagreement handling, and expert validation.

Noisy and misleading labels

Suppose a support-ticket dataset uses “customer clicked helpful” as the label for answer quality. Some customers may receive a correct answer and never click. Others may click accidentally. The label is convenient, but it only approximates the outcome we truly care about.

This is a proxy label: a measurable substitute for a harder-to-measure target.

Before trusting labels, ask:

  • Does this label represent the real goal?
  • Was it available and measured consistently?
  • Could the label contain historical unfairness?
  • How often do knowledgeable reviewers disagree?
  • Are missing labels distributed unevenly?

Why labels exist: the teaching signal

Recall the training loop from the Machine Learning article: a model makes a guess, compares that guess to the correct answer, and adjusts its internal parameters to reduce the error. The label is that correct answer — without it, there’d be nothing for the model to compare its guess against, and the entire training loop described in that article would have no way to know whether a guess was good or bad.

This is precisely what separates supervised learning from its unsupervised counterpart, both introduced briefly in the Machine Learning article. Supervised learning means training on labeled data — every example comes with its correct answer attached, exactly as described here. Unsupervised learning means training on data with no labels at all, where the model has to find structure on its own without ever being told what’s “correct.”

flowchart LR
    A[Features: square footage, bedrooms, location] --> B[Model's Prediction]
    C[Label: actual sale price] --> D[Compare prediction to label]
    B --> D
    D --> E[Adjust model's parameters]

ANALOGY vs. TECHNICAL REALITY

Analogy: Think of a language-learning app that shows you a flashcard: the word “perro” on the front, and “dog” printed on the back. You guess, flip the card, and check whether you were right. The answer on the back of the card is the label — the ground truth your guess gets checked against.

Where this breaks down: When you check a flashcard, you consciously understand why you were right or wrong, and you can reason about related words. A model has no such comprehension — it mathematically adjusts numerical parameters based purely on how far its guess was from the label, with no conceptual understanding of the word “dog” or “perro” involved at any point.

What a label looks like, depending on the task

The exact form a label takes depends directly on the type of problem being solved, mirroring the classification-versus-regression split introduced in the Machine Learning article:

  • In a classification task, the label is a category: “spam” or “not-spam,” “cat,” “dog,” or “bird,” “fraudulent” or “legitimate.”
  • In a regression task, the label is a number: an actual sale price, an actual temperature, an actual stock value.

In both cases, the label represents ground truth — a real, known, verified outcome that already happened or was independently confirmed, not a guess or estimate.

A concrete example, start to finish

Consider a hospital building a model to predict 30-day patient readmission, the same example used in the Dataset article. Each patient record’s features might include age, diagnosis, and length of stay. The label for that record is simply whether that specific patient actually was readmitted within 30 days — a fact known after the fact, from real hospital records, not something anyone had to guess. The model’s whole job during training is to learn which combinations of features tend to line up with a “yes” label versus a “no” label.

Where labels actually come from, and why it’s expensive

Labels don’t usually appear for free. Someone — often a human — has to determine and record the correct answer for every single training example, a process called labeling or annotation. Sometimes this happens naturally as a side effect of real-world events (a hospital already records whether a patient was readmitted; a bank already records whether a transaction was disputed as fraudulent).

Other times, it requires deliberate human effort — people manually reviewing thousands of photos to tag “cat” or “not cat,” or reviewing emails to mark “spam” or “not spam.” This labeling effort is frequently the single most expensive and time-consuming part of building a supervised Machine Learning system, well before any actual training happens.

Key terms

  • Label: The expected answer attached to a supervised example.
  • Target: Another common name for the value being predicted.
  • Annotation: Information added to an example, often by a person.
  • Label noise: Incorrect or inconsistent labels.
  • Proxy label: A measurable substitute for the outcome we actually care about.

Check your understanding

Does every Machine Learning dataset contain labels? No. Unsupervised and self-supervised approaches can learn without manually attached labels.

Can an accurately copied historical outcome still be a bad label? Yes. The outcome may encode unfair decisions or fail to represent the real goal.

Common misconception

Beginners sometimes assume labels are always perfectly objective and error-free, simply because they’re called “ground truth.” In practice, labels can be wrong — a human labeler misclassifies a photo, a hospital record contains a data-entry error, a fraud label gets assigned incorrectly because the original investigation was flawed. A model trained on noisy or incorrect labels will faithfully learn to reproduce those errors, exactly as the Pattern article warned about data quality generally. “Ground truth” is a useful term, but it’s not a guarantee of perfection — it’s only as reliable as the process that produced it.

Label, target, annotation, and ground truth

TermSimple meaning
TargetThe value a supervised task is trying to predict.
LabelThe stored answer attached to an example.
AnnotationExtra meaning added to raw data, sometimes including one or several labels.
Ground truthThe accepted reference answer used for training or evaluation, even though it can contain mistakes or disagreement.

Not every learning method requires human-written labels. Self-supervised learning creates teaching targets from the data itself, such as hiding a word and asking the model to predict it. Unsupervised learning searches for structure without a supplied answer column.

Where this fits in what comes next

You now have both halves of a training example clearly defined: Feature (the information given to the model) and Label (the correct answer being learned). The next article, Algorithm, introduces the actual mathematical procedure that uses features and labels together to produce a working, trained Model — the two topics that follow immediately after it in this sequence.

In one sentence

A label is the known, correct answer attached to a training example, and it’s the essential teaching signal that lets a supervised model learn, through repeated comparison and adjustment, to turn features into accurate predictions.

Author
TechByteByByte Editorial Team
Reviewed by
TechByteByByte Admin
Published
Last reviewed