Back to all lessons
Machine LearningBeginner

🤖What is Machine Learning?

From examples to predictions

Take your time with this one. The interactive parts are here to help you test the idea, not rush through it.

20 min- Explore at your own pace

Before We Begin

What we are learning today

Traditional programming is following a recipe. Machine learning is more like giving the computer many finished cakes and letting it reverse-engineer the recipe. It learns patterns that guide future decisions.

How this lesson fits

Here’s where the magic shows up: we stop hand-writing every rule and let data teach the model. Think of it as coaching instead of scripting.

The big question

How can a machine spot patterns from examples the way a student learns from practice problems?

Tell the difference between predicting numbers and discovering patternsInterpret simple models and talk through their outputs in plain EnglishCompare the strengths and tradeoffs of common ML methods

Why You Should Care

This is the skeleton of every AI headline you hear: data, model, training, prediction. Once you see that structure, the buzzwords become clear.

Where this is used today

  • Netflix / Spotify recommendations
  • Credit card fraud detection
  • Email spam filters

Think of it like this

Like teaching a dog a new trick. You don’t move its paws for it—you reward the closer attempts until it figures it out.

Easy mistake to make

Learning patterns is not the same as human understanding. A model can perform well without “knowing” meaning like we do.

By the end, you should be able to say:

  • Explain machine learning in plain language
  • Distinguish supervised, unsupervised, and reinforcement learning
  • Identify the roles of data, labels, features, and predictions

Think about this first

What’s an example of a task that’s easier to learn from examples than to program by hand? Why?

Words we will keep using

modeltrainingfeaturelabelprediction

What is Machine Learning?

Here is the simplest way to think about machine learning: instead of writing every rule by hand, you give the computer examples and let it discover a useful pattern. That is why ML is powerful on tasks where hand-written rules would be too long, too fragile, or too hard to invent.

Traditional rules
if price > 500000 and bedrooms == 3: classify as "expensive"
Machine learning
model.fit(house_data, prices)   ← learns automatically

Three Flavours of ML

The model learns from examples that already have the right answer attached. Think: spam vs not spam, or house features vs house price.

Supervised Learning in Action: Line Fitting

This is one of the cleanest ML examples. We show the model points, and it tries to draw the line y^=mx+b\hat{y} = mx + b that matches them as well as possible. The red segments show the mistakes. The blue line is the model's best attempt.

Try dragging the Noise slider. Notice how the dots scatter. The model struggles to find a clean line when the data gets messy.

Key Vocabulary

Feature (X)The input. What the model sees (like square footage or pixel color).
Label (y)The answer. What the model tries to guess (like price or "cat").
Training setThe study guide. The examples the model sees while learning.
Test setThe final exam. New examples the model has never seen before.
OverfittingMemorizing the answers instead of understanding the subject.
UnderfittingFailing to learn the pattern because the model is too simple.

Quick Check

Imagine you have 10,000 emails already marked as “Spam” or “Not Spam.” You want to train a model to spot spam in the future. What kind of machine learning is that?