← Code

Machine learning with Gradio

How a computer learns from examples: rules by hand, a nearest-neighbour model written yourself, fair testing, then scikit-learn and a model behind a Gradio app, with what models get wrong.

Start1. Rules by hand

Models by hand

Rules, then a nearest-neighbour model you write yourself, and how to test a model fairly.

1Rules by handNot started
2The nearest penguinNot started

Write a real machine-learning model yourself: to guess a new penguin's species, find the most similar penguin in the data and copy its answer.

  1. Predict
  2. Run
  3. Investigate › Where the learning is
  4. Investigate › How sure?
  5. Investigate › Spot the bug
  6. Modify › Ask for the measurements
  7. Modify › Not sure
  8. Five mystery penguins
  9. Where this leads
Start lesson
3A fair testNot started

Hold back some penguins to test on: a model tested on the data it learned from looks perfect, and only new data shows how good it really is.

  1. Predict
  2. Run
  3. Investigate › The perfect score
  4. Investigate › Why shuffle
  5. Investigate › Spot the bug
  6. Modify › Less to learn from
  7. Modify › Each species
  8. Rules or neighbours?
  9. Where this leads
Start lesson

Real tools

The same ideas in scikit-learn, then a model behind an app, and what models get wrong.

4The same model in scikit-learnNot started

Build the nearest-neighbour model and the fair test again with scikit-learn, the library data scientists use, then compare it with a decision tree.

  1. Predict
  2. Run
  3. Investigate › By hand and by library
  4. Investigate › The same columns
  5. Investigate › Spot the bug
  6. Modify › Five neighbours
  7. Modify › A decision tree
  8. The best measurements
  9. Where this leads
Start lesson
5A model behind an appNot started
6What models get wrong OptionalNot started

Find where the penguin model fails: a species it has never seen, impossible measurements and harder questions, and learn to say what a model cannot do.

  1. Predict
  2. Run
  3. Investigate › Sure but wrong
  4. Investigate › Where the data came from
  5. Modify › Too far away
  6. Modify › Harder questions
  7. A model card
  8. Where this leads
Start lesson

Progress is saved in this browser only. Nothing is sent anywhere.

For teachers: Teacher guide (notes, answers, solutions, slides and worksheets)