Lesson 1 · Intro to Machine Learning
What is Machine Learning?
Understand what machine learning is, how it differs from traditional programming, and why it matters.
Welcome to the Course
This course will take you from zero to training your first real machine learning model. By the end, you'll understand the core concepts well enough to build on them independently.
Let's start with the most fundamental question.
The Traditional Programming Paradigm
In classical programming, a human expert encodes their knowledge as explicit rules:
# Rule-based approach: the human writes all the logic
def should_approve_loan(income: float, credit_score: int, existing_debt: float) -> bool:
if credit_score < 580:
return False
if existing_debt / income > 0.43: # debt-to-income ratio
return False
if income < 30_000:
return False
return True
This works for well-understood, stable domains. But it breaks down when:
- The rules are too complex to enumerate
- The rules change frequently
- The rules aren't known — only the outcomes are
The Machine Learning Paradigm
Machine learning inverts the traditional approach. Instead of writing rules, you provide examples and let the system discover the rules itself.
Traditional: Input + Rules → Output
Machine Learning: Input + Output (examples) → Rules
# ML approach: the model learns from historical loan data
from sklearn.ensemble import GradientBoostingClassifier
import pandas as pd
# Load historical decisions (10,000 past loan applications)
df = pd.read_csv("loan_history.csv")
X = df[["income", "credit_score", "existing_debt"]] # features
y = df["approved"] # labels (0 or 1)
model = GradientBoostingClassifier()
model.fit(X, y) # Learn patterns from history
# Now predict on new applications
new_application = [[55_000, 720, 12_000]]
prediction = model.predict(new_application) # → [1] (approved)
Three Types of Machine Learning
Supervised Learning
The most common type. You have labelled data — input-output pairs — and the model learns to map inputs to outputs. This course focuses here.
Unsupervised Learning
No labels. The model finds structure in the data on its own. Useful for discovering customer segments, anomalies, or compressed representations.
Reinforcement Learning
An agent learns by interacting with an environment, receiving rewards for good actions and penalties for bad ones. Powers game-playing AI and robotics.
Key Vocabulary
| Term | Definition |
|---|---|
| Feature | An input variable (e.g., income, credit score) |
| Label | The target variable to predict (e.g., approved / rejected) |
| Training set | Data used to fit the model |
| Validation set | Data used to tune hyperparameters |
| Test set | Data used for final evaluation — never touched during training |
| Model | The mathematical function that maps features to labels |
| Loss function | A measure of how wrong the model's predictions are |
Keep your test set sacred. If you evaluate on your test set during development, you'll optimise for that data specifically — and you'll get a falsely optimistic view of real-world performance.
Why Now?
Machine learning isn't new — the algorithms have existed for decades. What changed:
- Data — The internet generated unprecedented amounts of labelled data
- Compute — GPUs enabled training on massive datasets in reasonable time
- Algorithms — Better optimisers (Adam), architectures (deep networks), regularisation techniques
The ideas behind neural networks date to the 1940s (McCulloch & Pitts). The modern deep learning revolution was enabled by hardware and data, not fundamentally new mathematics.
What's Next
In the next lesson, we'll dive into supervised learning in depth — understanding loss functions, gradient descent, and the training loop that underlies all ML models.