Notebooks
Twelve notebooks, one per section, each runnable cold in Colab
Every section of the workshop has a notebook. They are English-primary, with a one-line Spanish summary under each heading — cada encabezado lleva un resumen en español.
How they are built
Each notebook follows the same shape, so you always know where you are:
- Header — the section title, its objectives, and an Open in Colab badge.
- Setup — installs and imports only what this section needs, and loads its own data. Self-contained: no local files, no dependency on any other notebook.
- Explanation and code, alternating, building up rather than dumping a wall of code at you.
- Exercises —
# TODOstubs taken from the handbook, each followed by a folded solution cell. Open it after you have tried. - Closing — the Kahoot check for that section, and a link back here.
The notebooks are committed with no outputs and no execution counts. Every number you see is one you produced. The expected results are quoted in the prose so you can tell whether yours are right — and if yours differ, that is worth investigating rather than dismissing.
The notebooks
| # | Notebook | Covers | Colab |
|---|---|---|---|
| 00 | 00-setup-and-data.ipynb |
Setup and welcome — Load every dataset and confirm your runtime works before anything else. | |
| 01 | 01-what-a-tensor-is.ipynb |
What a tensor is — The vocabulary, shape in NumPy, and the three operations that matter. | |
| 02 | 02-thinking-in-n-dimensions.ipynb |
Thinking in N dimensions — Argue about what each axis means, and why a batch axis differs from a time axis. | |
| 03 | 03-indexing-and-broadcasting.ipynb |
Indexing and broadcasting real data — Select the right column of real tumour data, then meet zero-variance pixels. | |
| 04 | 04-reshape-and-transpose.ipynb |
Reshape and transpose real images — HWC to CHW, NHWC to NCHW, and why reshape silently destroys an image. | |
| 05 | 05-video-pipeline-design.ipynb |
Video pipeline design — Design the tensor shape at every stage of two real video systems. | |
| 06 | 06-contraction-with-einsum.ipynb |
Contraction with einsum — One notation for the dot product, the matrix product, and a batch of images. | |
| 07 | 07-inverses-and-pseudoinverse.ipynb |
Inverses and the pseudoinverse — Solve a 20,433-equation system that has no exact solution. | |
| 08 | 08-recursion-with-matrices.ipynb |
Recursion with matrices and vectors — Apply one matrix again and again: Fibonacci, eigenvectors, and a real forecast. | |
| 09 | 09-convolution-and-deconvolution.ipynb |
Convolution and deconvolution — Convolution is a structured matrix product, and blur can be partly undone. | |
| 10 | 10-tucker-decomposition.ipynb |
Tucker decomposition on real data — PCA generalized to every axis, on a real tensor of New York taxi trips. | |
| 11 | 11-wrap-up-and-take-homes.ipynb |
Wrap-up and take-homes — What connects Blocks 4, 5 and 6, plus five take-home exercises. |
Running them somewhere other than Colab
The notebooks only need the scientific Python stack. Locally:
git clone https://github.com/project-delphi/tensors-workshop.git
cd tensors-workshop
uv run --with numpy,pandas,scikit-learn,scikit-image,scipy,jupyterlab jupyter labscikit-learn and scikit-image ship the tumour data, the handwritten digits and the photographs, so most sections work with no network at all. Sections 07, 08 and 10 fetch a CSV from GitHub the first time they run.
What each notebook needs
| Notebook | Beyond NumPy | Network |
|---|---|---|
| 00 | pandas, scikit-learn, scikit-image, scipy |
yes — all three CSVs |
| 01 | scikit-learn, scikit-image, scipy.linalg |
no |
| 02 | — | no |
| 03 | scikit-learn |
no |
| 04 | scikit-image |
no |
| 05 | — | no |
| 06 | scikit-learn, scikit-image |
no |
| 07 | pandas |
yes — California housing |
| 08 | pandas |
yes — airline passengers |
| 09 | scikit-image, scipy |
no |
| 10 | pandas |
yes — NYC taxi trips |
| 11 | scikit-learn |
no |