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:

  1. Header — the section title, its objectives, and an Open in Colab badge.
  2. 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.
  3. Explanation and code, alternating, building up rather than dumping a wall of code at you.
  4. Exercises# TODO stubs taken from the handbook, each followed by a folded solution cell. Open it after you have tried.
  5. 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. Open In Colab
01 01-what-a-tensor-is.ipynb What a tensor is — The vocabulary, shape in NumPy, and the three operations that matter. Open In Colab
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. Open In Colab
03 03-indexing-and-broadcasting.ipynb Indexing and broadcasting real data — Select the right column of real tumour data, then meet zero-variance pixels. Open In Colab
04 04-reshape-and-transpose.ipynb Reshape and transpose real images — HWC to CHW, NHWC to NCHW, and why reshape silently destroys an image. Open In Colab
05 05-video-pipeline-design.ipynb Video pipeline design — Design the tensor shape at every stage of two real video systems. Open In Colab
06 06-contraction-with-einsum.ipynb Contraction with einsum — One notation for the dot product, the matrix product, and a batch of images. Open In Colab
07 07-inverses-and-pseudoinverse.ipynb Inverses and the pseudoinverse — Solve a 20,433-equation system that has no exact solution. Open In Colab
08 08-recursion-with-matrices.ipynb Recursion with matrices and vectors — Apply one matrix again and again: Fibonacci, eigenvectors, and a real forecast. Open In Colab
09 09-convolution-and-deconvolution.ipynb Convolution and deconvolution — Convolution is a structured matrix product, and blur can be partly undone. Open In Colab
10 10-tucker-decomposition.ipynb Tucker decomposition on real data — PCA generalized to every axis, on a real tensor of New York taxi trips. Open In Colab
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. Open In Colab

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 lab

scikit-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

Colab already has every one of these installed.
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