From 38e2adce8c02767773f905573bc25a10188f766e Mon Sep 17 00:00:00 2001 From: devmtnaing Date: Sun, 1 Nov 2026 14:42:52 +0630 Subject: [PATCH] Lesson: show where per_img's row means come from The one-value-per-row screen subtracted per_img without showing its values. Now it shows each row's mean first, then the stretch and subtraction. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01T85pZTr611HcS7wydhD4D7 --- src/lib/ai/lessons.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/lib/ai/lessons.ts b/src/lib/ai/lessons.ts index 6e1316c..b88db90 100644 --- a/src/lib/ai/lessons.ts +++ b/src/lib/ai/lessons.ts @@ -215,6 +215,16 @@ per_img = images.mean(axis=1, keepdims=True) # (4, 1) images - per_img # (4, 3) ✓ \`\`\` +First, \`per_img\` holds each row's mean: (5 + 6 + 7) / 3 = 6, and so on down the rows. + +${viz( + grid([[5, 6, 7], [3, 4, 5], [9, 8, 7], [1, 2, 3]], { hl: ['0,*'], cap: 'images (4, 3)' }), + 'mean(axis=1) →', + grid([[6], [4], [8], [2]], { hl: ['0,0'], cap: 'per_img (4, 1)' }), +)} + +Then the column is copied across the 3 columns (dashed boxes) and subtracted box by box. The first box is 5 − 6 = −1: + ${viz( grid([[5, 6, 7], [3, 4, 5], [9, 8, 7], [1, 2, 3]], { cap: 'images (4, 3)' }), '−',