DocsStation
ML

Features and Labels in Machine Learning

By csestudy247 Updated November 23, 2026 9 min read
9 min read
Features and Labels in Machine Learning

In Machine Learning, data is generally divided into two important parts: features and labels. Features provide the input information to the model, while the label or target represents the output that the model is trying to predict.

Easy Definition:

Features = Input

Label / Target = Output

Features → Model → Label

graph LR A[“📊 Features Input Variables”] B[“🤖 Machine Learning Model”] C[“🎯 Label / Target Output”] A –> B B –> C style A fill:#005cbf,color:#fff,stroke:#333,stroke-width:3px style B fill:#6f42c1,color:#fff,stroke:#333,stroke-width:3px style C fill:#28a745,color:#fff,stroke:#333,stroke-width:4px

1. What Are Features?

Simple Explanation

Features are the input variables or characteristics that a Machine Learning model uses to learn patterns and make predictions.

Real-Life Example: House Price Prediction

🏠 House Price Prediction

Suppose we want to predict the price of a house. We may use:

  • Area of the house
  • Number of bedrooms
  • Number of bathrooms
  • House age
  • Location

These are the features because they provide information to the model.

graph TD A[“🏠 House”] A –> B[“📐 Area”] A –> C[“🛏️ Bedrooms”] A –> D[“🚿 Bathrooms”] A –> E[“📅 Age”] A –> F[“📍 Location”] B –> G[“🤖 ML Model”] C –> G D –> G E –> G F –> G G –> H[“💰 Predicted Price”] style A fill:#6f42c1,color:#fff,stroke:#333,stroke-width:3px style B fill:#005cbf,color:#fff,stroke:#333,stroke-width:3px style C fill:#005cbf,color:#fff,stroke:#333,stroke-width:3px style D fill:#005cbf,color:#fff,stroke:#333,stroke-width:3px style E fill:#005cbf,color:#fff,stroke:#333,stroke-width:3px style F fill:#005cbf,color:#fff,stroke:#333,stroke-width:3px style G fill:#ff9800,color:#fff,stroke:#333,stroke-width:3px style H fill:#28a745,color:#fff,stroke:#333,stroke-width:4px
Exam Definition: A feature is an input variable or measurable characteristic used by a Machine Learning model to make predictions.
Remember: Feature → Input used by the model

2. Independent Variables

Simple Explanation

In supervised Machine Learning, features are often called independent variables. They are represented by variables such as:

X₁, X₂, X₃, … Xₙ

The model uses these variables to predict the dependent variable.

📌 Example: Student Placement
Feature Example Value
CGPA 8.5
Study Hours 6 hours
Internship Yes
Projects 3

These variables are inputs to the model and can be treated as independent variables.

Exam Definition: Independent variables are input variables used to explain or predict the dependent variable.
Easy Trick: Independent Variable = Input

3. What Is a Label?

Simple Explanation

A label is the known output associated with a training example in supervised Machine Learning. It is the value that the model learns to predict.

Example: Spam Detection

📧 Email Spam Detection

Suppose our model receives information about emails. The features might include:

  • Number of links
  • Number of words
  • Presence of suspicious words
  • Sender information

The label can be:

  • Spam
  • Not Spam
graph LR A[“📧 Email Features”] B[“🤖 ML Model”] C[“🏷️ Label”] A –> B B –> C C –> D[“Spam / Not Spam”] style A fill:#005cbf,color:#fff,stroke:#333,stroke-width:3px style B fill:#6f42c1,color:#fff,stroke:#333,stroke-width:3px style C fill:#ff9800,color:#fff,stroke:#333,stroke-width:3px style D fill:#28a745,color:#fff,stroke:#333,stroke-width:4px
Exam Definition: A label is the known output or target value associated with a training sample in supervised Machine Learning.
Remember: Label → What the model should predict

4. Dependent Variable

Simple Explanation

The dependent variable is the output that depends on the input features. In Machine Learning, the dependent variable is commonly called the:

  • Target
  • Label
  • Output variable
🏠 House Price Example

Suppose:

Area = 1500 sq ft

Bedrooms = 3

Age = 5 years

The model predicts:

House Price = ₹60 lakh

Here, house price is the dependent variable because it is the output we want to predict.

Exam Definition: The dependent variable is the output variable whose value is predicted or explained using one or more independent variables.
Easy Trick: Dependent Variable = Output / Target

5. Feature Matrix X

Simple Explanation

In Machine Learning, the collection of input features is commonly represented by the capital letter:

X

When there are multiple samples and multiple features, X is called the feature matrix.

📊 Example Dataset
CGPA Study Hours Projects Placement
8.5 6 3 Yes
7.2 4 2 No
9.1 7 4 Yes

The feature matrix X contains:

  • CGPA
  • Study Hours
  • Projects

The Placement column is the target.

Feature Matrix Representation

X = [
    [8.5, 6, 3],
    [7.2, 4, 2],
    [9.1, 7, 4]
]

Here:

  • Rows → Samples
  • Columns → Features
graph TD A[“Feature Matrix X”] A –> B[“Rows”] A –> C[“Columns”] B –> D[“Samples”] C –> E[“Features”] style A fill:#6f42c1,color:#fff,stroke:#333,stroke-width:3px style B fill:#005cbf,color:#fff,stroke:#333,stroke-width:3px style C fill:#005cbf,color:#fff,stroke:#333,stroke-width:3px style D fill:#28a745,color:#fff,stroke:#333,stroke-width:3px style E fill:#28a745,color:#fff,stroke:#333,stroke-width:3px
Exam Definition: The feature matrix X is a matrix containing the input features for all samples in a Machine Learning dataset.
Remember: X = Features / Inputs

6. Target Vector y

Simple Explanation

The target or label values are commonly represented using lowercase:

y

For a supervised Machine Learning problem, y contains the output values that the model is trying to predict.

y = [
    "Yes",
    "No",
    "Yes"
]

In this example:

  • X = student features
  • y = placement labels
graph LR A[“X Feature Matrix”] B[“🤖 ML Model”] C[“y Target Vector”] A –> B B –> C style A fill:#005cbf,color:#fff,stroke:#333,stroke-width:3px style B fill:#6f42c1,color:#fff,stroke:#333,stroke-width:3px style C fill:#28a745,color:#fff,stroke:#333,stroke-width:4px
Exam Definition: The target vector y contains the target or output values corresponding to the samples in the feature matrix X.
Remember: y = Target / Label / Output

7. Understanding X and y Together

Suppose we have the following dataset:

CGPA Study Hours Projects Placement
8.5 6 3 Yes
7.2 4 2 No
9.1 7 4 Yes

Then:

X = [
    [8.5, 6, 3],
    [7.2, 4, 2],
    [9.1, 7, 4]
]

y = [
    "Yes",
    "No",
    "Yes"
]
graph LR A[“X Feature Matrix”] A –> B[“CGPA”] A –> C[“Study Hours”] A –> D[“Projects”] E[“y Target Vector”] E –> F[“Yes”] E –> G[“No”] E –> H[“Yes”] style A fill:#005cbf,color:#fff,stroke:#333,stroke-width:3px style B fill:#005cbf,color:#fff,stroke:#333,stroke-width:2px style C fill:#005cbf,color:#fff,stroke:#333,stroke-width:2px style D fill:#005cbf,color:#fff,stroke:#333,stroke-width:2px style E fill:#28a745,color:#fff,stroke:#333,stroke-width:4px style F fill:#28a745,color:#fff,stroke:#333,stroke-width:2px style G fill:#28a745,color:#fff,stroke:#333,stroke-width:2px style H fill:#28a745,color:#fff,stroke:#333,stroke-width:2px
Most Important Formula:

X → Input Features

y → Target / Output

Model learns the relationship:

X → y

8. Independent Variable vs Dependent Variable

Concept Meaning Machine Learning Term Symbol
Independent Variable Input used to make a prediction Feature X
Dependent Variable Output being predicted Target / Label y
Exam Shortcut:

Independent Variable → Feature → X

Dependent Variable → Target/Label → y

9. Classification Example

Email Spam Detection

Number of Words Number of Links Suspicious Words Label
100 5 Yes Spam
50 1 No Not Spam
120 8 Yes Spam

Here:

X = Number of Words, Number of Links, Suspicious Words

y = Spam / Not Spam

For classification problems, the target y usually represents a category or class. Examples: Spam / Not Spam, Cat / Dog, Yes / No.

10. Regression Example

House Price Prediction

For regression, the target is generally a numerical value.

Area Bedrooms Age Price
1200 2 5 ₹40 lakh
1800 3 3 ₹65 lakh
2500 4 2 ₹90 lakh

Here:

X = Area, Bedrooms, Age

y = Price

In regression, the target y is generally a continuous numerical value such as price, salary, temperature, or house area.

11. Complete Feature → Label Workflow

graph TD A[“📊 Dataset”] A –> B[“X = Features”] A –> C[“y = Label / Target”] B –> D[“🤖 Machine Learning Model”] C –> D D –> E[“🧠 Learn Relationship X → y”] E –> F[“📥 New Input X”] F –> G[“🔮 Prediction ŷ”] style A fill:#6f42c1,color:#fff,stroke:#333,stroke-width:3px style B fill:#005cbf,color:#fff,stroke:#333,stroke-width:3px style C fill:#28a745,color:#fff,stroke:#333,stroke-width:4px style D fill:#ff9800,color:#fff,stroke:#333,stroke-width:3px style E fill:#6f42c1,color:#fff,stroke:#333,stroke-width:3px style F fill:#005cbf,color:#fff,stroke:#333,stroke-width:3px style G fill:#28a745,color:#fff,stroke:#333,stroke-width:4px

During training, the model receives both X and the corresponding y values in supervised learning. It learns a relationship between them. Later, when a new X is provided, the model produces a predicted output, commonly written as:

ŷ (y-hat)

Important Symbols:

X → Features / Inputs

y → Actual Target / Label

ŷ → Predicted Target

12. Quick Revision for Exams

Features: Input variables used by the model.

Independent Variables: Variables used as inputs to predict the output.

Label: Known output associated with a training sample.

Dependent Variable: Output variable being predicted.

Feature Matrix X: Matrix containing input features for multiple samples.

Target Vector y: Vector containing the corresponding target values.

Prediction ŷ: Output predicted by the trained model.


13. One Diagram to Remember Everything

graph LR A[“📥 Input Data”] B[“X Feature Matrix”] C[“🤖 ML Model”] D[“y Actual Target”] E[“ŷ Predicted Target”] A –> B B –> C D –> C C –> E B -. “Independent Variables” .-> C D -. “Dependent Variable” .-> C style A fill:#6f42c1,color:#fff,stroke:#333,stroke-width:3px style B fill:#005cbf,color:#fff,stroke:#333,stroke-width:4px style C fill:#ff9800,color:#fff,stroke:#333,stroke-width:3px style D fill:#28a745,color:#fff,stroke:#333,stroke-width:4px style E fill:#e91e63,color:#fff,stroke:#333,stroke-width:4px

Conclusion

Features and labels are fundamental concepts in supervised Machine Learning. The easiest way to remember them is:

Features = Input = Independent Variables = X

Label = Target = Dependent Variable = y

Prediction = ŷ

The model learns the relationship between X and y during training and then uses new feature values X to generate predictions ŷ.

document.addEventListener(“DOMContentLoaded”, function() { if (typeof mermaid !== “undefined”) { mermaid.initialize({ startOnLoad: true, theme: “base”, securityLevel: “loose”, themeVariables: { fontFamily: “Arial”, fontSize: “15px” } }); } });

Features and Labels in Machine Learning Quiz

1. What is a feature in Machine Learning?



  • The final prediction made by a model


  • An input variable used by the model


  • The error of the model


  • The name of the algorithm

2. What is another common name for a feature?



  • Dependent variable


  • Target variable


  • Independent variable


  • Prediction variable

3. In Machine Learning, what does the target or label represent?



  • Input data


  • Output that the model is trying to predict


  • Number of features


  • Training algorithm

4. Which symbol is commonly used to represent the feature matrix?



  • y


  • z


  • X


  • T

5. If a dataset has 1,000 samples and 5 features, what is the typical shape of the feature matrix X?



  • (5, 1,000)


  • (1,000, 5)


  • (1,005)


  • (5, 5)

6. If X represents the features and y represents the actual target values, what does a trained model generally produce for a new X?



  • Another feature matrix only


  • A predicted target value ŷ


  • A new training dataset


  • A hyperparameter

7. In a feature matrix X, what do the columns generally represent?



  • Samples


  • Predictions


  • Features


  • Labels only

8. In a house price prediction problem, which of the following can be a feature?



  • House price


  • Prediction error


  • Number of bedrooms


  • Model accuracy

9. In a house price prediction problem, what is the dependent variable if the goal is to predict the house price?



  • Number of bedrooms


  • House area


  • House price


  • Location

10. Which statement correctly describes the relationship between X and y in supervised learning?



  • X contains targets and y contains features


  • X contains features and y contains target values


  • Both X and y contain only features


  • Both X and y contain model parameters

11. What is the dependent variable also commonly called in Machine Learning?



  • Feature


  • Independent variable


  • Target or label


  • Hyperparameter

12. Suppose X contains student CGPA, study hours, and number of projects, while y contains Placement = Yes/No. What does y represent?



  • Feature matrix


  • Independent variables


  • Target vector


  • Hyperparameters

13. What does y-hat (ŷ) generally represent in Machine Learning?



  • Actual target value


  • Feature matrix


  • Predicted target value


  • Training dataset

14. In a spam detection system, which of the following is most likely to be a label?



  • Number of words in an email


  • Number of links


  • Spam or Not Spam


  • Email length

15. In a regression problem, which of the following can be a target variable y?



  • Number of bedrooms


  • House area


  • House price


  • Location

Scroll to Top