What is Machine Learning?
Machine Learning is the branch of AI where computers learn patterns from examples, improving through experience instead of relying on manually programmed rules.
Learning Objectives
- Define Machine Learning and contrast it with rule-based programming.
- Walk through the train → predict → improve loop with a concrete example.
- Distinguish supervised, unsupervised, and reinforcement learning.
- Explain why data quality matters more than algorithm choice.
- Identify which everyday systems are ML and what type they use.
Why This Matters
Machine Learning is not one application of AI. It is modern AI. The chatbots, recommenders, fraud detectors, and translators you use are all ML underneath. Understanding the learning loop (data in → patterns learned → predictions out) gives you the single mental model that explains the behavior, strengths, and failures of everything else in this curriculum.
Everyday Analogy
Imagine teaching a child to sort fruit. You never explain rules like "bananas are elongated, curvature 10–25 degrees…" You show many apples, many bananas, many oranges. The child gradually notices the patterns: shape, color, size. Soon they sort fruit they have never seen, including a slightly odd green-tinged orange, because they learned the pattern, not a memorized list.
That is Machine Learning: examples in, patterns discovered, predictions on new cases out.
The Learning Loop, Step by Step
Every ML system follows the same loop. Take a spam filter as the running example:
- Collect labelled examples. 100,000 emails, each tagged spam or not-spam by humans.
- Train. The algorithm processes the examples and adjusts millions of internal numbers (parameters) to capture what distinguishes spam: certain words, sender patterns, link density.
- Predict. A brand-new email arrives. The trained model outputs: "97% likely spam."
- Improve. When users click "Not spam" on a mistake, that correction becomes new training data. The next training run gets better.
Notice what the programmer wrote: zero spam rules. They wrote the learning procedure; the data wrote the rules.
The Three Types of Machine Learning
| Type | Learns from | Example question | Everyday use |
|---|---|---|---|
| Supervised | Labelled examples (input → correct answer) | "Is this email spam?" | Spam filters, medical diagnosis, price prediction |
| Unsupervised | Unlabelled data — finds hidden structure | "Which customers are similar?" | Customer segments, anomaly detection |
| Reinforcement | Trial, error, and rewards | "Which move wins the game?" | Game AI, robotics, tuning chatbots (RLHF, see AI-076) |
Supervised learning dominates industry because labelled data plus a clear question is the most common business situation.
Worked Example: Predicting House Prices
A supervised model in miniature. Training data:
| Size (sqm) | Bedrooms | Distance to center | Sold for |
|---|---|---|---|
| 80 | 2 | 5 km | $220,000 |
| 120 | 3 | 8 km | $310,000 |
| 95 | 2 | 2 km | $305,000 |
| …10,000 more rows… |
Training discovers the pattern: roughly +$2,400 per sqm, +$20k per bedroom, −$9k per km from center (in reality, far subtler interactions). Now a new listing (100 sqm, 3 bedrooms, 4 km out) gets a predicted price of ~$295,000 even though the model never saw this exact house. Pattern, not lookup.
This tiny example also reveals ML's weakness: if the training data only contained city apartments, the model will price a farmhouse absurdly. Models are only as good as the data they learned from (lesson AI-006).
Real-World Showcase
- Visa and Mastercard score billions of transactions in real time, with supervised models flagging fraud in milliseconds using patterns learned from past fraud.
- Spotify's Discover Weekly mixes supervised and unsupervised learning over listening histories of half a billion users.
- Google Translate switched from a decade of hand-written linguistic rules to learned models in 2016, and quality jumped more in that one year than in the previous ten. The clearest historical proof that learning beats rule-writing at scale.
Common Mistakes
- Thinking the algorithm matters most, when practitioners spend 80% of their time on data because data quality sets the ceiling.
- Expecting ML to explain itself: it learned statistical patterns, not human-readable reasons.
- Believing more data always helps; more biased data just entrenches the bias (see AI-062).
- Confusing memorization with learning. A good model generalizes to new cases; one that only recalls training examples is "overfitting" (see AI-005).
Try It Yourself
- Play "be the model": have a friend write 10 numbers following a secret rule (e.g., doubles minus one). Guess the next number, get feedback, adjust. That felt effort of updating your guess from examples is training.
- Find the three types in your own life: name one supervised system you used today (spam filter), one unsupervised (a "customers like you" segment), one reinforcement-trained (a chatbot polished with human feedback).
- Teach the fruit analogy to someone, then ask them: "What happens if I only ever showed the child red apples?" Their answer, "they'd fail on green apples," is data bias, discovered independently.
Key Takeaways
- ML = learning patterns from examples; the data writes the rules, not the programmer.
- The loop: labelled data → training → prediction → feedback → better model.
- Three types: supervised (labelled answers), unsupervised (hidden structure), reinforcement (rewards).
- Data quality beats algorithm cleverness: garbage in, garbage out.
- Models generalize patterns; they fail where their training data has gaps.
Glossary
- Machine Learning
- The branch of AI where computers learn patterns from examples and improve through experience, instead of relying on manually programmed rules. In the spam-filter example, the programmer writes only the learning procedure; the data writes the rules.
- Training
- The step where an algorithm processes labelled examples and adjusts millions of internal numbers (parameters) to capture distinguishing patterns. For a spam filter, that means learning which words, sender patterns, and link densities separate spam from legitimate mail. (see AI-005)
- Label
- The known correct answer attached to a training example, such as an email tagged "spam" or "not spam" by a human. Labels are what make supervised learning possible, and user corrections like clicking "Not spam" become fresh labels.
- Supervised Learning
- Learning from labelled examples where each input has a known correct answer, answering questions like "Is this email spam?" or "What will this house sell for?" It dominates industry because labelled data plus a clear question is the most common business situation.
- Unsupervised Learning
- Learning from unlabelled data to find hidden structure, answering questions like "Which customers behave similarly?" Everyday uses include customer segmentation and anomaly detection.
- Reinforcement Learning
- Learning through trial, error, and rewards rather than labelled answers. It is the approach behind game AI, robotics, and tuning chatbots with human feedback. (see AI-067)
- Overfitting
- When a model memorizes its training examples instead of learning the underlying pattern, so it recalls old cases perfectly but fails on new ones. The house-price model priced a farmhouse absurdly because its city-apartment training data left a gap. (see AI-005)
- Data Bias
- Systematic gaps or skews in training data that the model faithfully learns and reproduces, like the child shown only red apples failing on green ones. More biased data does not help; it entrenches the bias. (see AI-062)
References
Knowledge Check
8 questions