What is a target variable?
A target variable is the value that a supervised machine learning model is trained to predict.
It represents the desired output associated with each training example.
Simple example
Suppose we want to predict house prices.
Each sample might contain:
- house size
- number of bedrooms
- location
- age of the property
- actual house price
Here, the first four values are features, while the actual house price is the target variable.
Features → Model → Predicted targetTargets can take different forms
A target variable may be:
- Numerical, such as house price, temperature, or sales amount
- Categorical, such as spam/not spam or approved/rejected
- Binary, when there are only two possible outcomes
The type of target helps determine what kind of supervised learning problem is being solved. Numerical targets are commonly associated with regression, while categorical targets are commonly associated with classification.
Target vs feature
- Features are the inputs used by the model.
- Target is the output the model is trying to learn to predict.
In classification problems, the target is often also called a label. The concept of a label is covered separately.
In short, the target variable is the outcome a supervised machine learning model learns to predict from the input features.
Learning Sequence
Machine Learning Curriculum
Explore Related Questions
Deepen your understanding across related Machine Learning topics.