Supervised Learning – Classification (Lecture
Notes)
1. Supervised Learning
Supervised learning is a type of machine learning where:
The model learns a mapping from input (X) to output (Y)
The training data includes correct answers (labels)
Goal: Learn from labeled data to make predictions on new, unseen data.
2. Types of Supervised Learning
There are two major types of supervised learning:
1) Regression
Predicts numbers
Output can be any value from infinitely many possible values
Example:
o House price prediction
o Temperature prediction
2) Classification
Predicts categories (classes)
Output belongs to a small, finite set of possible values
Example:
o Cancer detection (benign vs malignant)
o Email spam detection
o Cat vs dog image classification
3. What is Classification?
Classification is a supervised learning task where:
The output is a category or class
Categories can be:
o Binary (2 classes): 0 or 1
o Multi-class (more than 2 classes): 0, 1, 2, etc.
The terms class and category mean the same thing in classification.
4. Breast Cancer Detection Example
Problem
Build a system to help doctors detect breast cancer early.
Output Labels
0 → Benign (non-cancerous, not dangerous)
1 → Malignant (cancerous, dangerous)
Case 1: Single Input Feature
Input (X): Tumor size
Output (Y):
o 0 (Benign)
o 1 (Malignant)
📌 Data Visualization:
X-axis → Tumor size
Y-axis → Class (0 or 1)
This is classification, not regression, because:
Only two possible outputs exist
The model does NOT predict values like 0.4 or 1.6
Case 2: Multiple Output Classes
Suppose malignant tumors are divided into:
o Type 1
o Type 2
Now the model predicts:
0 → Benign
1 → Cancer Type 1
2 → Cancer Type 2
This is called multi-class classification.
5. Classification vs Regression (Key Difference)
Aspect Regression Classification
Output Numbers Categories
Possible outputs Infinite Finite
Example outputs 2.5, 100.7 0, 1, 2
Example problems House prices Cancer detection
6. Categories Can Be Numeric or Non-Numeric
Numeric categories:
o 0, 1
o 0, 1, 2
Non-numeric categories:
o Cat / Dog
o Spam / Not Spam
o Benign / Malignant
📌 Numbers in classification are labels, not quantities.
7. Using Multiple Input Features
Instead of just tumor size, we can use:
Tumor size
Patient age
Dataset:
Inputs (X):
o Age
o Tumor size
Output (Y):
o 0 (Benign)
o 1 (Malignant)
📌 Visualization:
Each point represents a patient
Circles → Benign tumors
Crosses → Malignant tumors
8. Decision Boundary
The learning algorithm finds a boundary line
This boundary separates:
o Benign tumors from malignant tumors
📌 Purpose of boundary:
Helps classify new patients
Determines on which side of the line a new data point lies
9. Real-World Cancer Detection
In real medical systems, many more features are used:
Thickness of tumor clump
Uniformity of cell size
Uniformity of cell shape
Other medical measurements
More features → better predictions.
10. Final Summary
Supervised learning learns X → Y using labeled data
Two main types:
o Regression: predicts continuous numbers
o Classification: predicts categories
Classification predicts from a small, finite set of outputs
Decision boundaries are used to separate different classes
Can use one or many input features