No history yet

Supervised Learning Basics

Learning from Examples

Machine learning often starts with a simple idea: learning from examples. Imagine teaching a child to identify different animals. You might show them a picture of a cat and say, “This is a cat.” Then you show them a picture of a dog and say, “This is a dog.” After seeing enough examples with labels, the child starts to recognize the patterns and can identify a cat or dog on their own. This is the core concept behind supervised learning.

Supervised learning is like teaching a kid using flashcards.

In supervised learning, we give a machine learning model a dataset where each piece of data is already labeled with the correct answer. The model’s job is to figure out the underlying rules that connect the data to its label. The “supervisor” is the labeled data itself, guiding the model toward the right conclusions.

Supervised vs. Unsupervised

The main alternative to supervised learning is called unsupervised learning. The difference is straightforward: supervised learning uses labeled data, while unsupervised learning uses unlabeled data.

Think about organizing a collection of photos. If you go through and label each photo with the names of the people in it, you can then easily find all pictures of a specific person. That’s like supervised learning. But what if you just told a program to group the photos based on who appears in them, without providing any names? The program would create clusters of photos that seem to feature the same person. It doesn't know their names, but it can spot the similarities. That's unsupervised learning.

Lesson image

Supervised models are trained to predict a specific outcome, like whether an email is spam or not. Unsupervised models are used to discover hidden structures in data, such as grouping customers into different market segments based on their purchasing behavior.

The Workflow

Developing a supervised learning model follows a general process. It all starts with the data.

First, you need a collection of data that has been accurately labeled. For a spam filter, this would be a large set of emails, each one marked as either “spam” or “not spam.” Creating high-quality labeled data is often the most time-consuming part of the process.

Next, this data is split into at least two parts: a training set and a testing set. This is a critical step.

Lesson image

The model learns the patterns and relationships from the training set. It's like studying for an exam. The model looks at the examples and their corresponding labels over and over, adjusting its internal logic to make its predictions match the correct answers.

Once the training is complete, the model is evaluated using the testing set. This data has been kept separate and unseen by the model. It's the final exam. By feeding the test data into the model and comparing its predictions to the actual labels, we can see how well it learned.

This cycle of training and testing is fundamental. It ensures that the model can generalize what it has learned to new, unfamiliar data, which is the ultimate goal of machine learning.

Quiz Questions 1/5

What is the fundamental characteristic of the data used in supervised learning?

Quiz Questions 2/5

An e-commerce company wants to group its customers into different segments based on purchasing habits, without any predefined categories. Which machine learning approach is most suitable?