Supervised Learning
đź§ Introduction to Supervised Learning
Supervised learning is one of the main branches of machine learning.
It refers to training a model using data where the correct answers (called labels) are already known.
1. What Does “Supervised” Mean?
It’s called supervised because the model learns from examples with answers.
Each training example includes:
- An input (often called ), like a list of features
- A known output or label (called ), like a category or number
The model learns a rule to map inputs to outputs:
Once trained, the model can be used to make predictions on unseen data.
2. Two Types of Supervised Learning
There are two major tasks:
Classification
The goal is to predict a category.
Examples:
- Spam or not spam
- Dog or cat
- Will the customer buy or not?
Regression
The goal is to predict a continuous number.
Examples:
- Price of a house
- Temperature tomorrow
- Amount of rainfall
3. Example (No Table)
Imagine you're trying to predict house prices.
You might have input features like:
- The size of the house
- The number of bedrooms
- The location
And for each house, you already know its price.
The model learns to predict price based on those features.
This is a regression problem, because the output is a number.
4. How Supervised Learning Works
The typical steps are:
- Split the dataset into a training set and a test set
- Train the model on the training set
- Evaluate the model on the test set
For evaluation, we use metrics like:
- Accuracy for classification
- Mean Squared Error (MSE) for regression
The goal is to create a model that performs well on new, unseen data.
5. Examples of Supervised Algorithms
There are many supervised learning algorithms, including:
- Linear Regression
- Logistic Regression
- k-Nearest Neighbors (kNN)
- Decision Trees
- Naive Bayes
- Support Vector Machines (SVM)
- Random Forests
- Boosting methods (e.g., AdaBoost, Gradient Boosting)
Each of these models has strengths and weaknesses depending on the dataset and the problem type.
Summary
Supervised learning is used when you have input–output pairs and want the model to learn from labeled data.
It includes both classification (predicting categories) and regression (predicting numbers).
In the next sections, we’ll explore common supervised models, starting with Linear Regression.