What IS Machine Learning?
Rules vs learning — and why that difference changes everything
📌 Before You Start
What you need for this module:
- Basic Python knowledge (variables, if-statements, functions)
- A curious mind — no ML experience required
Estimated time: ~45 minutes
What you’ll learn: The core idea behind ML, the 3 types of ML, and the workflow every ML project follows.
💡 The Big Idea
Traditional programming: You write the rules. The computer follows them.
Machine learning: You show the computer examples. The computer finds the rules.
Think about spam email. A traditional programmer might write: "if the email contains 'free money' or 'click here', mark it spam." This works — until spammers change their wording.
A machine learning approach shows the computer thousands of labeled examples (spam / not spam) and lets it figure out the patterns. When spammers adapt, you retrain with new examples. The rules update themselves.
This is the core shift: from explicit rules to learned patterns.
🧠 How It Works
The 3 Types of Machine Learning
🏫 Supervised Learning
You provide labeled examples (inputs + correct answers). The model learns to map inputs to outputs.
Examples: spam detection, image classification, predicting house prices.
🔍 Unsupervised Learning
You provide data without labels. The model finds hidden structure and patterns on its own.
Examples: customer segmentation, topic discovery in documents, anomaly detection.
🎲 Reinforcement Learning
An agent learns by trial and error, receiving rewards for good actions and penalties for bad ones.
Examples: game-playing AI (chess, Go), self-driving car navigation.
The ML Workflow
ML You Already Use
- Netflix recommendations — supervised + collaborative filtering (what do similar users like?)
- Autocorrect & autocomplete — language models trained on billions of text examples
- Spam filter — supervised classification trained on labeled emails
- Face unlock on your phone — trained on images of your face vs. others
- Credit card fraud detection — flags transactions that don’t match your normal pattern
▶️ See It In Code
This example shows the conceptual difference: a traditional rule-based classifier vs what the ML approach looks like. Run it and observe the output.
This is a static display — the interactive exercise below lets you modify the code.
👋 Your Turn
The classify_email_traditional function currently only catches 4 types of spam phrases. Add 3 more spam phrases to the spam_words list and test them.
Try phrases like: "act now", "limited time offer", "you have been selected" — or make up your own!
"act now". The .lower() call means you don’t need to worry about capitalization — just use lowercase in your list.☕ Brain Break — 2 Minutes
Think about 3 apps you use regularly. For each one, ask yourself:
- Does it get better over time, or learn from your behavior?
- Does it make personalized recommendations?
- Does it predict something (next word, next song, next product)?
If yes to any of the above — it almost certainly uses ML.
Examples to get you started: Spotify, TikTok, Google Maps, Gmail, Instagram, Duolingo, your phone’s keyboard. What does each one learn about you?
✅ Key Takeaways
- Traditional programming = you define the rules. ML = the model learns the rules from data.
- The 3 types of ML: Supervised (labeled data), Unsupervised (find patterns), Reinforcement (rewards & penalties).
- This course focuses on supervised learning — the most common type in industry and research.
- The ML workflow is always: Data → Features → Train → Evaluate → Predict → Iterate.
- ML is already everywhere in your daily life — you’re learning to build the systems you already use.
🎉 Module 1 Complete!
You now understand the core idea behind machine learning. In the next module, we’ll work with a real dataset and learn how to explore it before building any model.