Features and Labels

What Are Features and Labels?

Features are the inputs provided to a machine learning model, while labels are the outputs the model is trying to predict.

Features

The input information used by the model. Think of them as clues.

  • House size
  • Number of bedrooms
  • Location
Labels

The correct answers the model learns to predict. Think of them as the answer.

  • House price
  • Spam or Not Spam
  • Disease present

Understanding Features

Features are pieces of information that help a model make decisions.

House Price Prediction

Features

  • House size
  • Number of bedrooms
  • Location
  • Age of house

Label — Sale price

Understanding Labels

Labels are the correct answers provided during training.

Email Classification

Features — Email content, sender, subject

Label — Spam or Not Spam

Features vs Labels

FeaturesLabels
InputsOutputs
InformationCorrect Answer
Used for predictionUsed for learning

Feature Vectors

A feature vector contains all features describing a single observation.

Student Example

Feature Vector — [10, 95]

Meaning — 10 Study Hours, 95% Attendance

Types of Features

TypeExamples
NumericalAge, Income, Height
CategoricalColor, Country, Product Type
TextEmails, Reviews, Documents
ImagePhotos, Medical Scans
AudioSpeech, Music, Voice Commands

Structured vs Unstructured Features

Structured
  • Databases
  • Spreadsheets
  • Financial records
Unstructured
  • Images
  • Audio
  • Video
  • Text

Classification Labels

Animal Classification Example

Features — Image

Labels

  • Cat
  • Dog
  • Bird
  • Horse

Regression Labels

House Price Prediction

Features — House characteristics

Label — $450,000 (a number)

Binary Classification Labels

Binary Labels

Spam Detection — 0 = Not Spam, 1 = Spam

Medical Diagnosis — 0 = Healthy, 1 = Disease

Feature Engineering

Feature engineering creates new features that may help models learn more effectively.

Example

Raw Feature — Birth Year

Engineered Feature — Current Age (more useful)

Feature Selection

Benefits of Feature Selection
  • Faster training
  • Better accuracy
  • Less overfitting
  • Simpler models

Feature Scaling

Why Scaling Matters

Age — 25

Income — 100,000

Income dominates without scaling. Common methods: Normalization, Standardization.

Missing Features

Approaches to Missing Data
  • Remove records with missing values
  • Fill with average or median values
  • Predict missing values with a model

Label Quality

Incorrect Labels Cause Problems

Cat Image → Dog (wrong label)

The model learns incorrect patterns. High-quality labels are essential for supervised learning.

Common Mistakes

Mistakes to Avoid

Poor Features — Predicting exam scores using favorite color

Data Leakage — Using future information during training

Incorrect Labels — Labels that do not match the actual data

Features and Labels Summary

FeaturesLabels
InputsOutputs
Independent VariablesTarget Variables
Used for PredictionUsed for Learning

Practice Prompt

Identify the features and labels for each of the following problems:

Problems to Solve
  • Predicting house prices
  • Detecting spam emails
  • Predicting whether a patient has a disease
  • Recognizing animals from images

Need Help?

Ask the AI if you need help understanding features, labels, feature engineering, feature selection, or supervised learning datasets.