Source

From First Principles to TrayCheck

A course in machine learning, deep learning and ML system design, taught through your own project

This course is written for you, with one project as its running example: TrayCheck, the food-recognition and review app in this repository. Every idea is introduced because the project needs it. Each module is meant to be enough on its own: ideas are built from first principles, each from the ones before, with small worked examples you can follow on paper. Each module ends with a lab you run on the project's own data and an optional reading list pointing at the best free textbooks, university courses and papers.

It is also built for a specific goal: the interview for ISS Facility Services' AI & Machine Learning PoC Project Coordinator internship, a role that evaluates machine learning in a hospital food-service proof of concept rather than building it. Every module has a Why this matters for the internship section, and Modules 9–14 cover the selection criteria most directly.

It is organised like a one-semester university course: 14 modules, each roughly one week of part-time study. If your interview is close, use the ISS interview fast track first and come back for the rest.

New to this? Start with the study guide. It explains how to work through each module, gives the five-day interview fast track and a week-by-week plan, and lists exactly which parts of which references to read if a section doesn't click. None of that reading is required.

How this course was written. The explanations are original, built around this project, and revised twice in November 2026. The second revision rebuilt the fundamentals from first principles: each module opens with a You need line naming what it builds on; every symbol is defined where it first appears; and each core idea is shown working on a small example with numbers (fitting a line, a softmax, a backprop step, a convolution, an AUC, a Wilson interval) before it is applied to TrayCheck. Every number was computed and checked against the project's code and saved results. Sources are named in each module's Go deeper section, with the exact chapter, section or figure, so you can read the original explanation as well.


Who it's for and what you need

  • You can read and write basic Python (functions, lists, dictionaries, loops).
  • School maths is enough to start: arithmetic, fractions, percentages, squaring. Module 2 builds everything else from scratch (powers and logarithms, matrices, derivatives, probability, standard deviation, confidence intervals), only as far as the course needs.
  • A laptop with the project installed (HOW_IT_WORKS.md → Run it). Labs run on a CPU.

How each module works

Part What it gives you
Why this matters in TrayCheck The exact files and lines where the idea shows up
Why this matters for the internship Where the idea appears in the ISS role, and what to prioritise if time is short
You need The earlier modules and sections this one builds on
Concepts The idea built from first principles, with a small worked example before the real one
Worked example The idea applied to TrayCheck's real numbers
Lab A script in course/labs/ to run and modify; expected output is shown
Check your understanding Questions with hidden answers (click to expand)
Go deeper Optional second explanations and further reading, with chapters and sections named
Interview angle How to say it out loud in a few sentences

Run any lab from the repository root, for example:

python course/labs/lab01_first_look.py

Labs write charts to course/labs/output/ (ignored by git). Lab 8 needs TensorFlow (requirements-vision.txt); the others need only the packages in requirements.txt.


Syllabus

# Module You'll be able to… Lab
1 The big picture Explain machine learning from a worked example; say why photos need it; define AI, ML and deep learning by what each adds; frame TrayCheck precisely First look at the model's outputs
2 The maths and statistics you need Work with logarithms, matrices, derivatives and gradient descent; derive the standard error and the 95% interval from scratch Maths you can run
3 Python and SQL for data Work with NumPy arrays, pandas tables, SQL queries and charts The project's data, three ways
4 First learning algorithms Fit linear and logistic regression, derive and code softmax regression, and explain decision trees and gradient boosting Softmax regression from scratch
5 Neural networks and backpropagation Explain what a hidden layer adds, and how backpropagation trains a network A neural network by hand, with a gradient check
6 Training well Choose learning rates, spot overfitting, and use regularisation, augmentation and early stopping Training experiments
7 Convolutional neural networks Explain convolution, pooling, depthwise separable convolutions and residual connections Convolutions on a food photo; counting parameters
8 MobileNetV2 and transfer learning Explain TrayCheck's model and vision_train.py line by line, and what to ask about a vendor's model Taking the model apart
9 Data: quality, splits, leakage, labels and shift Check data quality, design honest splits, measure label agreement, and prepare a PoC test set Leakage, noisy labels and distribution shift
10 Evaluation Agree measures before testing; use confusion matrices, precision/recall, ROC, calibration, intervals and agreement statistics; explain results to staff Metrics by hand, calibration, temperature scaling
11 Humans in the loop and user testing Design review rules, estimate hidden errors from spot checks, and write UAT scenarios for an AI workflow Spot checks under the microscope
12 System design Turn operational needs into data requirements, map processes, design dashboards, test predictive analytics against baselines SQL on the records; a schema change
13 Responsible deployment Explain hospital food waste and its measurement, privacy and governance questions, and write a model card Generate a model card
14 Running the PoC, the interview, and capstones Run a PoC from plan to final report, and answer interview questions with confidence Conformal prediction sets

Plus: a study guide (how to do the course, exactly what to read), a glossary of every term used, and an annotated reference list.

ISS interview fast track (about 18 hours over five days)

The study guide has the day-by-day plan. In short:

  1. Module 1: machine learning worked by hand; AI, ML and deep learning precisely; TrayCheck framed (4 h)
  2. Module 2 Part B (the statistics) and Module 10 §1–§3 (4 h)
  3. Module 10 §4–§8 and Module 9: calibration, error bars, agreement; data quality and leakage (4 h)
  4. Modules 11, 12 and 13 (selected sections): spot checks, UAT, requirements, dashboards, privacy (4 h)
  5. Module 14: running the PoC, and the question bank out loud (2 h)

Full track (about 13 weeks)

Roughly one module per week, in order; the study guide has the week-by-week plan. Modules 4–7 are the mathematical heart of the course; take them slowly and do the labs properly, changing numbers and watching what happens.


The core library

You don't need to buy anything, or to read any of these: the modules are meant to stand alone. These are the best free places to see the same ideas explained a second way; each module's Go deeper section points to the exact parts.

Resource Type Why it's here
Google Machine Learning Crash Course, developers.google.com/machine-learning/crash-course Short course The clearest short treatment of thresholds, precision and recall, ROC, and data quality
Deep Learning (Goodfellow, Bengio, Courville, MIT Press 2016), deeplearningbook.org Textbook, free online The standard graduate reference; Chapter 1 frames AI, ML and deep learning
An Introduction to Statistical Learning, with Python (James, Witten, Hastie, Tibshirani, Taylor), statlearning.com Textbook, free PDF The gentlest rigorous introduction to ML and evaluation
Understanding Deep Learning (Prince, MIT Press 2023), udlbook.github.io Textbook, free PDF + notebooks The clearest modern explanations and figures
Dive into Deep Learning (Zhang, Lipton, Li, Smola), d2l.ai Interactive textbook, free Code-first, used in hundreds of university courses
Deep Learning with Python, 3rd ed. (Chollet & Watson, 2025), deeplearningwithpython.io Book, free online Written by Keras's creator; our code uses Keras
Stanford CS231n, Deep Learning for Computer Vision, notes at cs231n.github.io University course notes The best notes on image classification, CNNs and transfer learning
Google, Rules of Machine Learning and People + AI Guidebook Guides, free When ML is worth it; designing for people working with AI
3Blue1Brown, Neural networks series, 3blue1brown.com Video series Visual intuition for gradient descent and backpropagation
SQLBolt, sqlbolt.com Interactive lessons, free SQL for analysing structured data
Designing Machine Learning Systems (Huyen, O'Reilly 2022) and Stanford CS329S notes, stanford-cs329s.github.io Book (paid) + free notes ML system design in the real world

The full list, with papers and library documentation, is in references.md.


A map of the course

            Module 1: what learning is, framed as TrayCheck
                              │
    ┌─────────────────────────┼─────────────────────────┐
    ▼                         ▼                         ▼
Module 2: maths and statistics   Module 3: Python and SQL    (read in parallel)
    └────────────┬────────────┘
                 ▼
Module 4: regression, classifiers, trees ─► Module 5: neural networks ─► Module 6: training well
                                                                    │
Module 7: convolutional networks ◄──────────────────────────────────┘
                 │
                 ▼
Module 8: MobileNetV2 + transfer learning  (TrayCheck's model)
                 │
     ┌───────────┼──────────────┐
     ▼           ▼              ▼
Module 9:     Module 10:     Module 11:            ◄── the core of the ISS role
data          evaluation     humans in the loop
     └───────────┼──────────────┘
                 ▼
Module 12: system design ─► Module 13: responsible deployment ─► Module 14: running the PoC, interview