What is the difference between features and labels?
The main difference between features and labels is that features are the inputs given to a machine learning model, while labels are the known outputs the model learns to predict in supervised learning.
Features
Features describe the characteristics of each sample.
For example, when predicting house prices, features might include:
- house size
- number of bedrooms
- location
- age of the property
These values are provided to the model as input.
Labels
A label is the known answer associated with a training example.
For example, in an email spam classifier, the label might be:
- Spam
- Not spam
The model learns how the input features relate to these labels.
Key differences
- Role: Features are inputs; labels are outputs.
- Purpose: Features provide information for prediction; labels provide the correct answer during supervised training.
- Availability: Features are present in both training and prediction data. Labels are usually available during training but may be unknown when making a new prediction.
- Example: In spam detection, words, sender information, and links can be features, while
spamornot spamis the label.
A simplified view is:
Features → Model → Predicted labelDuring training, the predicted label can be compared with the known label so the model can improve.
In short, features describe the input example, while labels represent the answer the supervised model is trying to learn to predict.
Learning Sequence
Machine Learning Curriculum
Explore Related Questions
Deepen your understanding across related Machine Learning topics.