Notes

Label

A label is the “answer” attached to a data example. If your model is learning from past cases, the label is what you want it to learn to predict.

What a label means
In machine learning, each row (or example) often has features (inputs) and a label (target output). The label can be:

  • Categorical (classification): “spam” vs “not spam,” disease “positive” vs “negative.”
  • Numeric (regression): house sale price, delivery time in minutes, exam score.
  • Structured: a sequence (next word in a sentence), a bounding box around an object in an image, or a pixel-wise mask for segmentation.
Statistically, the label is the response variable (often written as y), while features are predictors (X).

Everyday examples

  • House-price model: features = square footage, neighborhood, bedrooms; label = final sale price.
  • Credit risk: features = income, debt ratio, payment history; label = defaulted (yes/no).
  • Medical test triage: features = age, symptoms, lab values; label = diagnosis category.
The label is what turns a dataset into “training data” for supervised learning.

Why labels matter in AI/ML
Labels define the task and the loss function you optimize (cross-entropy for class labels, squared error for numeric labels, etc.). If labels are wrong, inconsistent, or biased, models can learn the wrong patterns—leading to poor accuracy, unfair decisions, or brittle behavior. Many real ML problems are limited not by algorithms, but by the cost and quality of labeling (human annotation, weak labels, or noisy proxies).

Where you’ll see the term
In libraries like scikit-learn, labels are typically y; in PyTorch/TensorFlow, they’re often called targets. In evaluation, “ground truth labels” are the reference answers used to score predictions.

Label is the target value or class assigned to an observation, representing the outcome a model is trained to predict. In supervised learning, labels provide the ground truth needed to estimate model parameters, compute loss, and evaluate performance (e.g., accuracy or mean squared error). For example, in spam detection, each email’s label might be “spam” or “not spam,” guiding the classifier during training.

Imagine you’re sorting photos on your phone: you might tag one “cat,” another “dog,” and another “sunset.” Each tag is a label—a short name that tells you what the item is.

In machine learning, a label is the “correct answer” attached to a piece of data. For example, if the data is an email, the label might be “spam” or “not spam.” If the data is a house listing, the label could be the sale price. During training, the model looks at the data (its details) and tries to learn how to predict the label for new, unseen examples.