Code and Data

Copy a worked example. Change its data. Check the result.

Set up Python

Use Python 3.10 or newer. Run these commands in a new project folder.

python3 -m venv .venv
source .venv/bin/activate
python -m pip install -r requirements.txt

On Windows, activate with .venv\Scripts\activate.

Download requirements.txt.

Start with a full run

The examples use small synthetic data. They need no private datasets or paid API keys.

python q4_ml_coding_01.py
python q4_ml_coding_02.py
python q3_deep_learning_08.py

The first scripts fit linear and logistic models. The last trains a small PyTorch model.

The PyTorch run uses CPU or CUDA when present. Its training accuracy does not prove test accuracy.

Read helper examples

A file that only defines functions may print nothing. Call its function with the input shapes shown in the lesson.

Some code uses pandas, scikit-learn, or PyYAML. Install the listed packages before running it.

Numerical values may vary with library versions. Tests check results with a tolerance.

ML Fundamentals

Read the lesson

Examples 1 to 5

Examples 6 to 6

Statistics and Probability

Read the lesson

Examples 1 to 2

Deep Learning and LLMs

Read the lesson

Examples 1 to 5

Examples 6 to 8

ML Coding from Scratch

Read the lesson

Examples 1 to 5

Examples 6 to 10

Experimentation and Causal Inference

Read the lesson

Examples 1 to 5

Examples 6 to 7

Learning Theory

Read the lesson

Examples 1 to 3

Statistical Inference

Read the lesson

Examples 1 to 4

Probability and Information Theory

Read the lesson

Examples 1 to 5

Optimization

Read the lesson

Examples 1 to 5

Linear Algebra and Matrix Calculus

Read the lesson

Examples 1 to 5

Examples 6 to 7

The Practitioner's Toolkit

Read the lesson

Examples 1 to 5

Examples 6 to 9