Welcome to your second lesson! In our first session, we introduced machine learning using the analogy of teaching a child, where you provide examples (data) and the correct answers, and the machine learns the rules. Today, we're going to give those two concepts—the "data" and the "answers"—their official names.
Our goal is to distinguish between features (the inputs) and labels (the outputs) in a dataset. By the end of this lesson, you'll understand what these terms mean and be able to identify them in any simple machine learning problem. This is a fundamental concept for preparing data for an ML model.
Inputs and Outputs: Features and Labels
Let's go back to our analogy of teaching a child to recognize a dog. What information does the child use? They might look at the animal's size, the shape of its ears, the length of its tail, and whether it barks or meows. These individual pieces of information are the features. They are the inputs the child's brain uses to make a decision.
What's the "answer" you provide? You point and say, "That is a dog." That's the label. It's the correct output you want the child to learn for that specific set of features.
In machine learning:
- Features are the inputs—the characteristics or measurements of your data.
- Label is the output—the answer or the thing you want to predict.
The main goal of a simple ML model is to learn the relationship between the features and the label, so it can predict the label for new data it has never seen before.
A Concrete Example: Predicting House Prices
Let's imagine you want to build a machine learning model to predict the price of a house. What information would you use? You’d probably look at things like:
- The size of the house (in square feet).
- The number of bedrooms.
- The number of bathrooms.
These are your features. They are the input variables you will feed into the model.
What are you trying to predict? The price of the house. The price is your label. It's the output you want the model to learn to generate.
The image below shows exactly how this looks in a dataset. Each row is a different house, and the columns are divided into the features (the information about the house) and the label (the price we want to predict).

To solidify these definitions, please read the following brief explanations from an article on APX.AI.
Understanding Features and Labels in ML Data
This article provides clear, concise definitions for features and labels, which are the fundamental components of a machine learning dataset.
Please read the first three sections of the article. Focus on the definitions provided under the headings "Features: The Inputs or Predictors" and "Labels: The Output or Target." Finally, read the section "Features and Labels Together," paying close attention to the paragraph explaining how a model uses the example table to learn.
Another Way to Think: Ingredients and the Recipe
Analogies can be very helpful. One great way to think about features and labels is like a recipe. The features are the ingredients (flour, sugar, eggs), and the label is the final dish you're trying to make (a cake). The model learns from many examples of combining certain ingredients (features) to produce a specific dish (label).
The following video provides a great explanation of this idea.
Machine Learning: Features and Labels
This video from ByteMonk explains the relationship between features and labels using the intuitive analogy of a recipe.
Please watch the segment from features and labels. The speaker explains how features are like the "ingredients" and labels are like the "dish" you are trying to create, tying it back to the house price prediction example.
It's Not Just for Predicting Numbers
So far, our example has been about predicting a number (the price of a house). But labels can also be categories. Imagine a machine that sorts coins. You give it a coin, it weighs it, and then it tells you if it's a penny, a nickel, or a quarter.
- Feature: The weight of the coin. This is the input measurement.
- Label: The type of coin ("penny," "nickel," "quarter"). This is the output category we want to predict.
This type of problem, where you are predicting a category, is called classification. Predicting a number, like a house price, is called regression. We'll touch on this more later, but the key point is that the feature/label structure applies to both.
Watch this short clip from Simplilearn, which uses a coin sorting task to perfectly illustrate features and labels in a classification problem.
Machine Learning | What Is Machine Learning? | Introduction To Machine Learning | 2024 | Simplilearn
This video gives another simple, clear example of features and labels, this time for a classification task.
Watch the segment explaining supervised learning with coins, from the coin example. Notice how the coin's weight is the feature (input) and its currency is the label (output).
For the AWS exam, and in ML in general, you might hear other words used for features and labels. It's good to be aware of them:
- Features are also called: predictors, independent variables, or inputs.
- Labels are also called: target, dependent variable, or output.
The easiest way to remember is: Features are what you know; the label is what you want to predict.
Conclusion
In this lesson, we've defined the two most basic components of a machine learning dataset. Understanding this distinction is the first and most critical step in data preparation.
Here are the key takeaways:
- Features are the inputs to your model. They are the characteristics or attributes of your data that you use to make a prediction.
- Labels are the outputs. This is the "answer" you want your model to learn to predict. For training data, you already have the correct labels.
- The goal of the model is to learn the relationship that maps features to a label.
Now that we understand the roles of features and labels, our next lesson will look closer at the data itself. We will identify the three common data types you'll encounter in machine learning: numerical, categorical, and text. This is the next step in learning how to prepare your data for a model.