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 writes the rule first and runs it on data. Machine learning flips that arrangement: we provide examples, define the outcome we care about, and let the system fit a rule that works well on similar future cases. This lesson gives students the vocabulary to talk about that shift precisely.

How this lesson fits

This module is where the course shifts from explicit rules to learned patterns. Instead of telling the machine exactly what to do in every case, we give it examples, define success, and let it infer a decision rule from the data.

The big question

How can a machine study examples, extract useful patterns, and make predictions on cases it has never seen before?

Distinguish supervised, unsupervised, and reward-driven learning setupsInterpret the output of common models in plain English instead of opaque jargonCompare the tradeoffs between accuracy, interpretability, flexibility, and speed

Why You Should Care

This lesson is the skeleton behind most modern AI products: data comes in, a model is trained, and predictions come out. Once students can name those moving parts, the rest of the field becomes easier to reason about and critique.

Where this is used today

  • โœ“Recommendation systems that learn user preferences from past clicks, views, and purchases
  • โœ“Fraud detection systems that spot unusual transaction patterns in real time
  • โœ“Spam filters that learn the difference between trustworthy and suspicious messages

Think of it like this

It is like teaching by worked examples rather than by one perfect lecture. The learner studies many past cases, notices recurring patterns, and gradually becomes better at handling new ones that resemble what it has seen before.

Easy mistake to make

A model that learns patterns from data is not automatically understanding the world the way a person does. Strong performance and human-like understanding are not the same thing.

By the end, you should be able to say:

  • Explain machine learning in everyday language without losing technical accuracy
  • Distinguish supervised, unsupervised, and reinforcement learning by the type of feedback each receives
  • Identify the roles of data, features, labels, targets, models, and predictions

Think about this first

Name a task that would be painful to hand-code rule by rule but manageable if you had thousands of examples. What makes the example-based approach better?

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?