Skip to content

Data, Features and Labels

The raw material of machine learning: examples described by features (the inputs) and, for supervised learning, a label (the answer to predict).

Also dataset · feature · label · target · example · sample · input variables

Fig. / How it works
Example: its featuresExample: its featuresModelModelPredicted labelPredicted labelCompare with true labelCompare with true label
Domain 01
Foundations
Role · kind
DataConcept
Level
Beginner

Think of a stack of house listings. Each listing is an example. The size, number of rooms and neighborhood are the features. The sale price written at the bottom is the label the model learns to guess.

Where it fits

FoundationsFoundationsData, Features and Labels
+All relationships as a list

See it on the full map

How it works

Every machine learning project starts with data. A dataset is a collection of examples (also called samples or rows). Each example is described by:

  • Features: the measurable inputs. For a house: size in square meters, number of bedrooms, postcode. For an image: its pixel values. For text: its tokens.
  • A label (or target): the answer you want the model to predict, such as the sale price or “spam / not spam”.

Supervised learning learns the mapping from features to labels. Unsupervised learning only has features and looks for structure in them. Self-supervised learning invents labels from the data itself, for example “the next word”.

A few practical truths:

  • Garbage in, garbage out. Mislabeled, duplicated or unrepresentative examples hurt more than a slightly worse model choice. Getting good labels is its own discipline: see data labeling.
  • Features can be engineered. Turning a date into “day of week” or “is holiday” often helps a classical model a lot. See feature engineering.
  • Deep learning learns its own features from raw inputs like pixels, which is a big reason it took over vision and language.
  • Data must be split so the model is judged on examples it never saw. See train/test split.

Everyday use cases

  • Case 01

    Email spam filtering

    Features: words, sender, links. Label: spam or not spam, provided by people clicking the spam button.

  • Case 02

    House price estimation

    Features: size, location, age. Label: the price the house actually sold for.

Strengths, weaknesses and when to use it

Strengths

  • Thinking in features and labels turns a vague goal ("predict churn") into a concrete learning problem.

Weaknesses

  • Labels can be noisy, biased or expensive to collect; a model can only be as good as its data.

When to use itAt the very start of every project, to define exactly what goes in and what should come out.

Check yourself

  1. Q01

    In a model that predicts whether a photo shows a cat, what is the label?

    Show answer

    B: "cat" or "not cat"

  2. Q02

    Which learning paradigm uses features but no labels?

    Show answer

    B: Unsupervised learning