# Session 07 — Python demos

Small, self-contained scripts that illustrate ideas from
`07_creating_representations.html`. Each demo is < 200 lines, runs in a few
seconds on a laptop, and produces at least one figure.

## Setup

```bash
python -m venv .venv && source .venv/bin/activate
pip install -r requirements.txt
```

## Demos

### `demo_d3_user_movie_embeddings.py`
Train tiny 2-D user and movie embeddings on a synthetic ratings matrix
(9 users × 12 movies, 3 genres). The script snapshots the embeddings at
epochs 0, 5, 25, 100, 500 and plots them side by side, so the class can
watch random noise turn into three genre clusters with each user sitting
among the movies they like.

```bash
python demo_d3_user_movie_embeddings.py
# → embeddings_evolution.png
```

The whole model is ~8 lines (`nn.Embedding` × 2 + dot product); the whole
training loop is ~5 lines. That is the teaching moment.
