Machine Learning: The Engine of Modern AI
Supervised, unsupervised and reinforcement learning — the three ways machines learn from data.
What you will learn
- Name the three styles of machine learning
- Match a task to the right style
- Define features, labels and model
Three ways machines learn
| Style | You give it | It learns to | Example |
|---|---|---|---|
| Supervised | Examples with answers | Predict the answer for new data | Spam / not-spam, price prediction |
| Unsupervised | Data with no answers | Find groups or structure | Group customers by behaviour |
| Reinforcement | A goal + rewards/penalties | Act to earn the most reward | Game-playing AI, robots walking |
Supervised learning is the most common and where you should start: you show the model many examples that already have the right answer, and it learns to predict the answer for examples it has never seen.
The words you will use constantly
- Features — the inputs (e.g. hours studied, house size).
- Label — the answer you want to predict (pass/fail, price).
- Model — the pattern the algorithm learns, which then makes predictions.
- Training — the process of learning the model from data.
# Supervised data: features (X) paired with labels (y)
X = [[1], [2], [3], [5], [6], [8]] # hours studied
y = ['Fail','Fail','Fail','Pass','Pass','Pass'] # the answers
# The model will learn: roughly, study > 4 hours -> PassNote: Output: (No output yet — next lesson we feed exactly this kind of X and y to scikit-learn and let it learn the pattern automatically.)
New tool ahead: scikit-learn (a popular free Python library for machine learning) gives you ready-made models, so you do not have to write the maths yourself. We will use it in the very next lesson — just remember it as “the library that does the learning for us”.
Tip: How to choose: predicting a known answer? Supervised. Exploring data to find natural groups? Unsupervised. Learning by trial and error toward a goal? Reinforcement.
Q. You have 10,000 emails already labelled “spam” or “not spam” and want to flag new ones. Which style fits?
✍️ Practice
- Label each as supervised/unsupervised/reinforcement: predicting house prices; grouping news articles by topic; a robot learning to balance.
- For a “predict tomorrow’s temperature” task, name the features and the label.
🏠 Homework
- Describe a task from your own life for each of the three learning styles.