Start here · no maths needed
What is machine learning?
A plain-language start in about 15 minutes. It covers the big idea, the two main kinds of learning, how a model trains, why we split data into train and test, and why we look at data first. At the end: exactly what this course teaches (supervised learning) and what it does not.
What is machine learning?
1 · The big idea
What machine learning is, in one sentence
Ordinary software follows rules a person wrote. Machine learning flips that: you show the computer many examples, and it works out the rules itself. Show it eight flat sales and it finds the rule 'price rises about ₹0.78 lakh for each extra square metre'. Show it a million emails marked spam or not, and it finds a rule for spotting spam.
| Ordinary software | Machine learning | |
|---|---|---|
| Who writes the rule? | A programmer | The computer, from examples |
| What do you give it? | Rules and data | Data (and often the answers) |
| What do you get? | Answers | A rule you can reuse on new data |
| Good for | Clear, fixed rules | Patterns too complicated to write down |
2 · Two main kinds
Supervised and unsupervised learning
The first question to ask is: do my examples come with the answer I want to predict? If yes, that is supervised learning. The answer is called the label, and the computer is supervised because it can compare its guess with the label. If no, that is unsupervised learning: the computer looks for structure, such as groups, with nothing to check against.
- Flats with known prices
- Learned line
See the numbers behind this picture
| Area (sq m) | Flats with known prices | Learned line |
|---|---|---|
| 30 | – | 34.602 |
| 35 | 40 | – |
| 45 | 44 | – |
| 55 | 56 | – |
| 65 | 58 | – |
| 80 | 76 | – |
| 95 | 84 | – |
| 110 | 101 | – |
| 130 | 110 | – |
| 135 | – | 116.414 |
- Group 0
- Group 1
See the numbers behind this picture
| Area (sq m) | Group 0 | Group 1 |
|---|---|---|
| 35 | 0 | – |
| 45 | 0 | – |
| 55 | 0 | – |
| 65 | 0 | – |
| 80 | 0 | – |
| 95 | – | 0 |
| 110 | – | 0 |
| 130 | – | 0 |
import numpy as np
area = np.array([35, 45, 55, 65, 80, 95, 110, 130.0]) # square metres
price = np.array([40, 44, 56, 58, 76, 84, 101, 110.0]) # ₹ lakh
# SUPERVISED: every row comes with the answer we want to predict (the label)
w, b = np.polyfit(area, price, 1)
print(f"supervised: learned 'price = {w:.2f} x area + {b:.1f}' from labelled sales")
print(" prediction for an unsold 75 sq m flat:", round(float(w * 75 + b), 1), "lakh")
# UNSUPERVISED: same flats, answers hidden. Can the computer still find structure?
rng = np.random.default_rng(0)
x = (area - area.mean()) / area.std()
centres = np.array([x.min(), x.max()]) # start two groups at the extremes
for _ in range(10):
group = np.argmin(abs(x[:, None] - centres[None, :]), axis=1)
centres = np.array([x[group == k].mean() for k in (0, 1)])
print("unsupervised: found two groups of flats by size alone:")
for k in (0, 1):
print(f" group {k}: areas {area[group == k].astype(int).tolist()}")
print("no price was used, so there is nothing to 'check' the groups against")supervised: learned 'price = 0.78 x area + 11.2' from labelled sales
prediction for an unsold 75 sq m flat: 69.7 lakh
unsupervised: found two groups of flats by size alone:
group 0: areas [35, 45, 55, 65, 80]
group 1: areas [95, 110, 130]
no price was used, so there is nothing to 'check' the groups againstEdit and run this code in your browser
Live Python
The same eight flats, learned two ways
Runs in your browser on your device. Nothing you type is sent anywhere, and nothing here changes your saved progress.
Press Ctrl+Enter (⌘+Enter on Mac) to run. Tab moves focus to the next control, as usual; use spaces to indent.
Supervised, the computer learns 'price = 0.78 × area + 11.2' and predicts ₹69.7 lakh for an unsold 75 sq m flat. Unsupervised, it splits the flats into five smaller and three larger ones, with no way to say whether that split is 'right'.
| Kind | Question it answers | Examples |
|---|---|---|
| Supervised: regression | How much? | House price, delivery time, demand |
| Supervised: classification | Which one? | Spam or not, will this customer leave, loan default |
| Unsupervised: clustering | Which belong together? | Customer groups, similar articles |
| Unsupervised: dimensionality reduction | What are the main directions of variation? | Compressing many columns into a few |
3 · How training happens
Measure the miss, nudge, repeat
Training is a loop with three moves. First, measure how wrong the current rule is, as a single number called the loss. Second, work out which way to nudge each adjustable number to make the loss smaller. Third, nudge them a little and go round again. That is what you watched in the demo on the home page.
- Start with a rule that knows nothing, for example 'always quote the average price'.
- Measure the average miss across all examples.
- Nudge the slope and the height in the direction that reduces the miss, by a small step.
- Repeat until the miss stops getting smaller.
import numpy as np
area = np.array([35, 45, 55, 65, 80, 95, 110, 130.0])
price = np.array([40, 44, 56, 58, 76, 84, 101, 110.0])
a = area - area.mean()
w, level, rate_w, rate_l = 0.0, price.mean(), 0.00012, 0.06 # start from "always quote the average"
def avg_miss(w, level):
return float(np.mean(np.abs(w * a + level - price)))
print(f"step 0: slope {w:.3f} average miss {avg_miss(w, level):5.2f} lakh")
for step in range(1, 121):
miss = w * a + level - price # 1. how wrong is the line right now?
w -= rate_w * np.mean(2 * miss * a) # 2. nudge the slope so the squared miss falls
level -= rate_l * np.mean(2 * miss) # 3. nudge the height the same way
if step in (1, 5, 10, 20, 40, 120): # 4. repeat
print(f"step {step:3d}: slope {w:.3f} average miss {avg_miss(w, level):5.2f} lakh")step 0: slope 0.000 average miss 21.62 lakh
step 1: slope 0.179 average miss 16.82 lakh
step 5: slope 0.567 average miss 6.37 lakh
step 10: slope 0.722 average miss 2.45 lakh
step 20: slope 0.775 average miss 2.45 lakh
step 40: slope 0.779 average miss 2.48 lakh
step 120: slope 0.779 average miss 2.48 lakhEdit and run this code in your browser
Live Python
The training loop, written out
Runs in your browser on your device. Nothing you type is sent anywhere, and nothing here changes your saved progress.
Press Ctrl+Enter (⌘+Enter on Mac) to run. Tab moves focus to the next control, as usual; use spaces to indent.
See the numbers behind this picture
| Training step | Average miss |
|---|---|
| 0 | 21.625 |
| 1 | 16.821 |
| 2 | 13.12 |
| 3 | 10.267 |
| 4 | 8.069 |
| 5 | 6.375 |
| 6 | 5.07 |
| 7 | 4.064 |
| 8 | 3.289 |
| 9 | 2.763 |
| 10 | 2.447 |
| 11 | 2.265 |
| 12 | 2.247 |
| 13 | 2.301 |
| 14 | 2.342 |
| 15 | 2.374 |
| 16 | 2.399 |
| 17 | 2.418 |
| 18 | 2.433 |
| 19 | 2.444 |
| 20 | 2.453 |
| 21 | 2.459 |
| 22 | 2.464 |
| 23 | 2.468 |
| 24 | 2.471 |
| 25 | 2.474 |
| 26 | 2.476 |
| 27 | 2.477 |
| 28 | 2.478 |
| 29 | 2.479 |
| 30 | 2.48 |
| 31 | 2.48 |
| 32 | 2.48 |
| 33 | 2.481 |
| 34 | 2.481 |
| 35 | 2.481 |
| 36 | 2.481 |
| 37 | 2.481 |
| 38 | 2.481 |
| 39 | 2.482 |
The miss falls from ₹21.62 lakh, when the model just quotes the average, to about ₹2.45 lakh within 10 steps, and then barely moves. The step size is deliberately small, because a step that is too big overshoots. Bigger models and more data need many more steps, but the loop is the same.
4 · Train and test
Never grade a model on the examples it studied
A model that has seen the answers can score perfectly by memorising them. What we want to know is how it does on examples it has not seen, because that is what happens in real life. So before training we split the data: most rows are the training set the model learns from, and a few are held back as the test set, used once at the end to judge it.
import numpy as np
area = np.array([35, 45, 55, 65, 80, 95, 110, 130.0])
price = np.array([40, 44, 56, 58, 76, 84, 101, 110.0])
train, test = [0, 2, 3, 5, 6, 7], [1, 4] # hold two flats back; the model never sees them while learning
z = (area - 80) / 30
print("degree | training miss | miss on held-back flats")
for degree in [1, 2, 3, 5]:
coef = np.polyfit(z[train], price[train], degree)
miss = lambda idx: float(np.mean(np.abs(np.polyval(coef, z[idx]) - price[idx])))
print(f"{degree:6d} | {miss(train):13.2f} | {miss(test):.2f}")
coef = np.polyfit(z[train], price[train], 5)
print("degree 5 prediction for a 100 sq m flat:", round(float(np.polyval(coef, (100 - 80) / 30)), 1), "lakh (sales near 100 sq m were about 84 to 101)")degree | training miss | miss on held-back flats
1 | 2.34 | 2.58
2 | 2.29 | 2.75
3 | 2.03 | 2.46
5 | 0.00 | 8.83
degree 5 prediction for a 100 sq m flat: 90.1 lakh (sales near 100 sq m were about 84 to 101)Edit and run this code in your browser
Live Python
A flexible model aces what it studied and fails what it didn't
Runs in your browser on your device. Nothing you type is sent anywhere, and nothing here changes your saved progress.
Press Ctrl+Enter (⌘+Enter on Mac) to run. Tab moves focus to the next control, as usual; use spaces to indent.
- Training flats
- Held-back flats
See the numbers behind this picture
| Model flexibility (polynomial degree) | Training flats | Held-back flats |
|---|---|---|
| 1 | 2.34 | 2.58 |
| 2 | 2.29 | 2.75 |
| 3 | 2.03 | 2.46 |
| 5 | 0 | 8.83 |
A straight line misses the training flats by about ₹2.3 lakh and the held-back flats by ₹2.6 lakh, a fair estimate of real-life performance. The degree 5 curve has no miss at all on the training flats and a miss of ₹8.8 lakh on the held-back ones: it memorised. Its prediction for a 100 sq m flat is ₹90.1 lakh, too close to a lucky guess to trust. This is overfitting, and a held-back test set is how you catch it.
| Set | Used for | Rule |
|---|---|---|
| Training | Learning the weights | The model may study it freely |
| Validation (or cross-validation) | Choosing between models and settings | Use it as often as you like |
| Test | One final honest score | Look once, at the very end |
5 · Look first
Explore and plot your data before modelling
Before fitting anything, spend ten minutes looking at the table. How many rows and columns? What are the typical values and the extremes? Which columns move together? Are there odd values? This is exploratory data analysis, and a few plots catch most problems that would otherwise silently ruin a model.
import numpy as np
area = np.array([35, 45, 55, 65, 80, 95, 110, 130.0])
price = np.array([40, 44, 56, 58, 76, 84, 101, 110.0])
age = np.array([12, 3, 20, 8, 15, 2, 6, 25.0]) # a second column: years since construction
print("rows:", len(area), "| columns: area, age, price")
for name, col in [("area", area), ("age", age), ("price", price)]:
q1, med, q3 = np.percentile(col, [25, 50, 75])
print(f"{name:5s} min {col.min():6.1f} median {med:6.1f} max {col.max():6.1f} mean {col.mean():6.1f} std {col.std():5.1f}")
print("correlation with price: area", round(float(np.corrcoef(area, price)[0, 1]), 3), "| age", round(float(np.corrcoef(age, price)[0, 1]), 3))
z = (price - price.mean()) / price.std()
print("any price more than 2 std from the mean?", bool((abs(z) > 2).any()))
counts, edges = np.histogram(area, bins=4)
for c, lo, hi in zip(counts, edges[:-1], edges[1:]):
print(f"area {lo:5.0f}-{hi:5.0f} | {'#' * int(c)}")rows: 8 | columns: area, age, price
area min 35.0 median 72.5 max 130.0 mean 76.9 std 30.9
age min 2.0 median 10.0 max 25.0 mean 11.4 std 7.7
price min 40.0 median 67.0 max 110.0 mean 71.1 std 24.2
correlation with price: area 0.994 | age 0.26
any price more than 2 std from the mean? False
area 35- 59 | ###
area 59- 82 | ##
area 82- 106 | #
area 106- 130 | ##Edit and run this code in your browser
Live Python
A ten-line look at a small table
Runs in your browser on your device. Nothing you type is sent anywhere, and nothing here changes your saved progress.
Press Ctrl+Enter (⌘+Enter on Mac) to run. Tab moves focus to the next control, as usual; use spaces to indent.
See the numbers behind this picture
| Area band (sq m) | Flats |
|---|---|
| 35–59 | 3 |
| 59–82 | 2 |
| 82–106 | 1 |
| 106–130 | 2 |
Price and area move almost together (correlation 0.994), while age is only weakly related (0.26), so area is the column to model first. No price is more than two standard deviations from the mean, so no obvious outliers. Four lines of text histogram already show the sizes are spread fairly evenly.
6 · Your map
Where to learn each piece in this course
| You want to learn… | Go to |
|---|---|
| What a model looks like as maths | Math: algebra and functions |
| How to read and chart data | Python: pandas and visualization |
| Why and how to split data without leaking | Python: Data Preparation |
| Honest scores and the test set | Algorithms: Evaluation Foundations |
| Your first model, step by step | Algorithms: Linear Regression |
| Which model to use when | Algorithms: How to choose a model |
| How averages and uncertainty work | Math: statistics and the normal curve |
You do not need to read these in order. Pick whichever question you have, and every page links onward.
Ready? Go back to the home page demo, or open the Linear Regression lessons to build the model you just watched.
What you will learn
Supervised machine learning, end to end.
Supervised learning means learning from examples whose answers are known, such as house prices or customers who left. It is the part of machine learning behind most real products, and the best place to build solid foundations.
- 01
Explain why a model works
Read the maths behind a prediction (functions, derivatives, probability, optimization) and say what the model is doing, not only which function to call.
- 02
Write the Python for it
From your first line of Python to NumPy, pandas, scikit-learn and your own small classes, with every code cell runnable in the browser.
- 03
Prepare data without fooling yourself
Split first, build a baseline, put preparation inside a pipeline and avoid leakage.
- 04
Build and compare supervised models
Regression and classification: linear and logistic regression, k-nearest neighbours, naive Bayes, decision trees, random forests, gradient boosting, SVMs and a first neural network.
- 05
Judge the result honestly
Choose a metric that matches the decision, use validation and a locked test set, and test whether a gain is real or luck.
- 06
Take a problem from question to a shipped model
Frame it, build it, evaluate it, package it and see how it is deployed, practised on House Price, Customer Churn and Titanic.
How the course gets you there
- Math: algebra, calculus, linear algebra, probability, statistics, optimization and 12 bridges to ML, including hypothesis tests.
- Python: six short beginner lessons, then Essentials, NumPy, pandas, visualization, data preparation and scikit-learn.
- Algorithms: 13 supervised paths with playbooks, a model-choice guide and an end-to-end workflow.
- Projects: three guided Kaggle-style projects on real public data.
Not on the roadmap yet
So you know exactly what you are signing up for. Everything else you might expect is under Coming next, below.
- Reinforcement learning
- Time-series forecasting
- Running models at scale: monitoring, retraining and MLOps beyond a first deployment
Coming next
Where this path leads.
Planned modules, in the order that makes sense: natural language processing and computer vision both rest on deep learning, so it comes first. They are plans, not dates, and none of them is available yet. Until then, the lessons listed under each one are the best preparation.
- 01
Unsupervised learningComing soon
Finding structure when there are no answers: grouping similar customers, spotting unusual transactions, squeezing many columns into a few.
You will be able to: Cluster with k-means, reduce dimensions with PCA, and judge whether the groups mean anything.
Start preparing: Distance and norms · SVD · k-nearest neighbours
- 02
Deep learning foundationsComing soon
Neural networks with many layers, trained by backpropagation, built and debugged in code.
You will be able to: Train a deeper network, read its learning curves and fix one that will not learn.
Start preparing: Gradient descent · Neural networks (MLP) · Optimization
- 03
Natural language processingComing soon
Working with text: turning words into numbers, classifying messages, searching by meaning, and how language models work.
You will be able to: Build a text classifier and explain what a language model is predicting.
Start preparing: Naive Bayes · Logistic regression · Information and entropy
- 04
Computer visionComing soon
Learning from images: how a picture becomes numbers, convolutional networks, and checking what a model looks at.
You will be able to: Train an image classifier and explain why it got a picture wrong.
Start preparing: Linear algebra · Neural networks (MLP)
Build your first model: Linear Regression → · Math for machine learning · How to choose a model