No history yet

Introduction to Supervised Learning

Learning from Examples

Imagine teaching a child to identify different animals using flashcards. On one side of each card is a picture of an animal, and on the other is its name. You show the child a picture of a cat and say, "This is a cat." You do the same for a dog, a bird, and a fish. After showing many examples, the child learns to recognize a cat even if they've never seen that specific picture before.

This is the core idea behind supervised learning. The machine learning model is the child, the pictures are the data, and the names on the back of the cards are the "labels." The model learns by studying thousands or even millions of these labeled examples.

Supervised learning is like teaching a kid using flashcards.

The goal isn't for the model to just memorize the examples it has seen. The real test is whether it can accurately predict the label for new, unseen data. After training on photos of cats, can it correctly identify a cat in a photo it has never encountered? A successful supervised learning model can.

Lesson image

Supervised learning tasks generally fall into two main categories:

  • Classification: The goal is to predict a category or class. Is this email spam or not spam? Does this medical scan show a tumor or not?
  • Regression: The goal is to predict a continuous numerical value. What will the price of this house be? How many customers will visit a store tomorrow?

Where We See It

Supervised learning powers many applications you use every day. Your email's spam filter is a classic example of a classification model. It learned from countless emails that were manually labeled as "spam" or "not spam" to recognize junk mail automatically.

Weather forecasting apps use regression models to predict the temperature. They train on historical weather data, learning the relationship between factors like time of year, humidity, and wind speed to forecast future conditions. Other common applications include speech recognition, credit card fraud detection, and personalized product recommendations on shopping websites.

Essentially, if you have a dataset with a specific question you want to answer (like "Is this spam?" or "What's the price?"), supervised learning is often the right tool for the job.

The Learning Process

How does a model go from seeing data to making predictions? The process follows a few key steps. It all starts with the data.

First, you need a high-quality, labeled dataset. This is often the most time-consuming part. Someone, a human expert, has to go through the data and provide the correct answers or labels.

Next, this dataset is split. A large portion, called the training set, is used to teach the model. The model analyzes this data, looking for patterns that connect the inputs to their corresponding labels.

The remaining data, called the test set, is kept separate. After the model has been trained, we use this test set to evaluate its performance. Since the model has never seen this data before, it’s a fair way to see how well it learned to generalize. If the model performs well on the test set, it's ready to be used for making predictions on new data.

This cycle of collecting data, training, and evaluating is fundamental to building effective supervised learning models.

Quiz Questions 1/5

What is the defining feature of the data used in supervised learning?

Quiz Questions 2/5

What is the primary goal of training a supervised learning model?