Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/lib/ai/lessons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)' }),
'−',
Expand Down