Step 1 of 11 · 0 doneGuided tutorial · Intermediate
Machine Learning · Week 1 · Lecture 1 · Introduction to Machine Learning · Guided tutorial · Intermediate

Introduction to Machine Learning: learn it by doing it

By the end you will sort one fruit plant's problems into Data Mining, Machine Learning and AI, pick the right type of learning for each job, and explain the first big limit: the curse of dimensionality.

11
steps
≈ 52
minutes
✎
you need: pen and paper

Before you startHow to read a table of data (rows are examples, columns are measurements), how to take a square root on a calculator, and how to plot two numbers as a point on a graph. The theory behind every step is on the Blueprint page.

01

Put the fruit plant's jobs in order

3 min✓ done
One packing plant carries the whole tutorial. First idea: the 3 fields under the Data Science umbrella, and what each one does.
Explain

A packing plant wants a machine that sorts apples, bananas, mangoes and oranges without a person checking each fruit. Every step of this tutorial works on this plant.

Turning the plant's data into useful answers is Data Science. It is an umbrella over 3 fields: Data Mining discovers hidden patterns, Machine Learning builds models, and AI makes intelligent decisions. In the plant, mining notices that apples are usually red and smooth, the learner improves from its sorting mistakes, and the robot that sees a fruit and answers “Which fruit is this?” is the AI.

DATA SCIENCE · the umbrella Data Miningdiscoverspatterns Machine Learningbuildsmodels AImakes intelligentdecisions describe the past → learn from it → act on it

Data Mining describes the past, Machine Learning learns from it, AI acts on it. All of them need the raw data first.

Try it · put in order

Put the plant's four jobs in the order the work happens. Use ↑ and ↓ (Tab to a button, then Enter).

  1. A model improves from corrected sorting mistakes
  2. Collect raw data: measure the color, shape, size and texture of every fruit on the belt
  3. A robot sees the fruit, decides which it is and drops it in the right bin
  4. Find patterns in past records: “Apples are usually red and smooth”
02

Tell the features from the label

4 min✓ done
Before any learning, the plant's records become a table. Second idea: which columns go in, and which column comes out.
Explain

Each fruit on the belt becomes one row. The plant measures 4 things about it: color, shape, size and texture. Something you can measure is a feature: an input.

The column you want the machine to predict, Fruit Type, is the label: the output. A table whose rows carry their labels is labeled data, and supervised learning learns to map the inputs (features) to the outputs (labels). On a brand-new fruit, the label is exactly what is missing.

4 features · inputslabel · output
colorshapesizetextureFruit Type
redroundmediumsmoothApple
yellowcylindricallongsmoothBanana
yellow-greenovalmediumsmoothMango
orangeroundmediumdimpledOrange

Data Mining reads patterns from these same columns: “Apples are usually red and smooth”, “Bananas are yellow and cylindrical”.

Try it · fill in the blanks

Complete the description of the plant's table.

Color, shape, size and texture are the ; Fruit Type is the . Because every row includes its Fruit Type, the table is data, which is what learning needs.

03

Spot where the learning happened

4 min✓ done
Third idea: what “learning” means for a program, in Mitchell's words: task T, experience E, performance P.
Explain

Machine learning is a program that learns from data and improves its performance without being explicitly programmed. Arthur Samuel (IBM) popularised the term in 1959 with a checkers program that got better by playing.

In 1997 Tom Mitchell made it precise: a program learns from experience E on tasks T, measured by performance P, if P improves with E. For the plant:

T · task
sorting fruit into the four bins
E · experience
the sorted and corrected fruit it has already seen
P · performance
the percentage of fruit sorted correctly
1957 · Rosenblatt's perceptron1959 · 'machine learning'1997 · T, E, P
Try it · choose one

Last week the plant's model called a mango an apple. A worker moved it to the right bin and the correction was stored. Today the model sorts mangoes correctly. What happened?

04

Let the data set the cut-off

5 min✓ done
Fourth idea: a learner finds the rule from labelled examples, where a programmer would write it by hand. Get your calculator.
Explain

A programmer writes the rule: “if redness ≥ 6 it is an apple”. A learner is given labelled examples and works the rule out itself.

programming: Data + Rules → Answers
machine learning: Data + Answers → Rules

A very simple learner on one feature puts its cut-off halfway between the two groups:

learned cut-off = (mean apple + mean mango) ÷ 2
hand-written: ≥ 6 ■ mango ● apple redness (0–10)

When the data change (brighter lamps, a redder harvest), the learner just recomputes. The hand-written rule stays wrong until someone rewrites it.

Try it · type a number

Today's six labelled fruits (redness, 0–10): apples 8, 7, 7.5 · mangoes 3, 4, 5. What cut-off does the learner find?

accepted within ± 0.05

05

Decide: classify, regress or cluster

4 min✓ done
Fifth idea: the kind of answer decides the kind of learning. Supervised learning has 2 types; with no labels you cluster.
Explain

supervised learning learns from labeled data and has 2 types. Classification predicts a discrete label, a category: email spam detection uses Spam (1), Not Spam (0); an animal classifier uses Cat (1), Dog (2), Bird (3), Fish (4). Those numbers are only codes. Regression predicts a continuous value: “how much?” (a monthly electricity bill) or “how many?” (products sold).

unsupervised With no label column at all, clustering groups similar examples; people name the groups later.

AskThen it is
Labels? yes · answer is a categoryclassification
Labels? yes · answer is an amountregression
Labels? no · find groupsclustering
Try it · match each case

The plant's owner also runs an office. Match each job to its task.

06

Your turn: label a new fruit by its nearest neighbour

7 min · 3 parts✓ done
Steps 2, 4 and 5 together: use labelled fruits (features + labels) to predict the label of a fruit nobody has tagged. Pen and calculator.
Explain

The nearest-neighbour method plots every labelled fruit as a point (size, redness) and gives a new fruit the label of the closest one. Distance: subtract the sizes, subtract the rednesses, square both, add them, take the square root.

d = √((size₁ − size₂)² + (red₁ − red₂)²)

Worked for fruit A: new fruit X = (5, 7), A = (6, 8): d = √((5 − 6)² + (7 − 8)²) = √(1 + 1) = √2 = 1.41.

0246810 246810 sizeredness A apple B mango C orange X ? 1.415.00?
Try it · your turn, 3 parts

A new fruit X arrives: size 5, redness 7. Three labelled fruits are on the table.

fruitsizerednesslabeldistance to X
A68Apple1.41
B34Mango(a) ?
C83Orange5.00
07

Group fruit that has no labels

4 min✓ done
Seventh idea: unsupervised learning. Same features, same distance as step 6, but no Fruit Type column to copy.
Explain

A new supplier sends crates with the same 4 features measured but no Fruit Type column: the data is unlabeled. That is unsupervised learning.

Clustering puts fruits whose features are close into the same group, using the distance you computed in step 6. The algorithm only says “these belong together”. A person looks at each group afterwards and assigns the label: “these look like apples”.

Supervised: features → known labels. Unsupervised: features only → groups, named by people later.

Try it · click the diagram

The plot shows 8 unlabeled fruits from the new supplier. Click (or Tab + Enter) every fruit that belongs to the same cluster as P1, the ringed one.

0246810 246810 sizeredness 1 2✓ 3✓ 4✓ 5✓ 6✓ 7✓ 8✓

selected points turn solid and get a ✓

08

Name the parts of a reinforcement learner

5 min✓ done
Eighth idea: learning from rewards instead of labels, with the 5 components S, A, R, S', π.
Explain

Some tasks have no answer key, only feedback. In reinforcement learning an agent acts in an environment and receives positive or negative rewards; its goal is to maximise the long-term cumulative reward. Sutton and Barto's 1998 textbook is the standard reference. The 5 key components: State (S), Action (A), Reward (R), Next State (S'), Policy (π).

AGENTpolicy π picks A ENVIRONMENTin state S action A reward R · next state S'

The lecture's 6 steps: a child on a bicycle is in a State (wobbling, slow), takes an Action (pedal, steer, lean, brake), gets a Reward (balanced: +, falls: −), reaches a Next State, forms a Policy, and improves through the Learning Process: exploration and exploitation.

Try it · match the pairs

The plant's picking arm learns the same way as the child on the bicycle. Match each line to its component.

09

Choose how to reuse a pre-trained model

4 min✓ done
Ninth idea: transfer learning. Start from a model that already learned a related task, and fine-tune it.
Explain

Someone who speaks Spanish learns Italian much faster than someone starting from nothing: grammar and many words carry over, only the differences need practice.

Transfer learning reuses a pre-trained model, one already trained on a large related task: ResNet for images (it won ImageNet in 2015) or BERT for text (Google, 2018). You keep its layers, add a new output layer for your own classes and fine-tune: update only a few layers on your own data instead of training everything from scratch.

early layersedges, coloursreused
middle layersshapes, texturesreused
top layersobject partsfine-tuned
new outputapple · banana · mango · orangenew
Try it · choose one

The plant now wants to recognise its 4 fruits from camera photos, but it has only a small set of labelled photos. Which plan is transfer learning done right?

10

Count the cells the data must fill

5 min✓ done
Tenth idea: the first big limit. More features are not free: the space the data must fill grows very fast.
Explain

Every feature is a dimension. To learn well you need examples in every region of the feature space. Split each feature into just 2 ranges (low, high): 1 feature gives 2 cells, 2 features give 2 × 2 = 4, 3 features give 8. The number of regions doubles with every added dimension.

1 feature: 22 features: 43 features: 8

Richard Bellman named this the curse of dimensionality in 1957. It causes 4 problems: (1) increased sparsity, the same examples spread over far more cells; (2) higher computational cost; (3) overfitting risk; (4) distance-based issues: for k-NN and clustering, all points appear equally distant.

Try it · predict, then reveal

The plant keeps adding measurements until each fruit has 10 features, each split into 2 ranges. Set the slider to your prediction of the number of cells, then press Check.

100
02,048
11

Put it all together

7 min · 8 parts✓ done
One last shift at the plant. Each decision uses an earlier step; the step number is shown so you can look back.
Explain

Nothing new here: this is the whole lecture applied to one plant. For each situation, decide first whether there is a label, a reward, a pre-trained model or just raw data, then whether the answer is a category, an amount or a group. Finally ask whether the plan adds features faster than the data can fill them.

  • 1Data Mining · ML · AI
  • 2features and labels
  • 3T, E, P
  • 4rules learned from data
  • 5classify · regress · cluster
  • 6nearest neighbour
  • 7clustering
  • 8S, A, R, S', π
  • 9pre-trained, fine-tune
  • 10curse of dimensionality
Try it · capstone

Answer all eight, then Check.

✓

What you can do now

Each outcome is ticked when the steps that teach it are done. Steps solved without opening the worked answer count towards your score.
  • Distinguish Data Science, Data Mining, Machine Learning and Artificial Intelligence using the fruit-sorting scenariostep 1 · not yet
  • Define machine learning as learning from data to improve performance without being explicitly programmedsteps 3, 4 · not yet
  • Differentiate supervised learning (classification and regression) from unsupervised learning (clustering) by whether the data is labeledsteps 2, 5, 6, 7 · not yet
  • Identify the components of reinforcement learning (State S, Action A, Reward R, Next State S', Policy π) in a worked examplestep 8 · not yet
  • Explain how transfer learning reuses and fine-tunes a pre-trained model for a related taskstep 9 · not yet
  • Describe the curse of dimensionality and its four problems: sparsity, computational cost, overfitting risk and distance-based issuesstep 10 · not yet
Your score
0 / 11

steps solved without the worked answer

Go to the Blueprint quiz

Before the lab: install Anaconda (docs.anaconda.com/anaconda/install/). The tutorial session builds on these ideas with real data.