Convolution layer as a matrix
Penguin learning project
The project uses 342 complete Palmer penguin records: 240 training-pool and 102 held-out rows. The selected training rows determine feature scaling and model parameters. Source CSV
This project trains weights with softmax, unlike the homepage lab, which uses nearest species averages. Same penguin measurements; different classification methods. Predictions can differ.
Convolution · Describe shared filters and downsampling.
Convolution, recurrent and residual architectures are not part of this linear penguin model.
Consider this concept alongside the project; its source assumptions may differ. These observations do not prove a theorem.
Input: 12 × 2; Held-out evaluation: 102 · #58 · 40.6 mm, 193 mm. Known answer: Adélie; Prediction: Adélie · [≈0.7383, ≈0.2444, ≈0.01737].
Used in these source sections: 6.1 Looking locally
A fixed convolution and downsampling layer is a linear map, so it can be written as a matrix multiplication.
The matrix form shows how weight sharing constrains a dense layer.
Source formula example
illustration · This computes a special fixed filter and downsampling choice.
Symbols
- Matrix representing the fixed linear convolution and sampling map.
- Flattened input grid.
- Output channel count.
- Side length after downsampling.
Source formula example
This source example uses its own inputs and assumptions. Editing it does not change the project.
Edit a value or the code, then run the example. This is a finite demonstration, not a proof of the paper’s theorem.
This example’s data flow
Code changed. Reset to restore this example’s data flow.
You choose
input.first= 1
Initial values in code
W=[[1, 0, 0, 0]]
Calculated here
Result expression: { x, W, output }
x=[input.first, 2, 3, 4]Uses:input.firstoutput=W.map((row) => row.reduce((sum, v, i) => sum + v * x[i], 0))Uses:W,x
Returns
x- array (4 items): [1, 2, 3, 4]
W- array (1 items): [array (4 items): [1, 0, 0, 0]]
output- array (1 items): [1]
Read numbers from input and return the result. JavaScript basics.
Result
Technical statement
The input is a 2 by 2 grid, d = 1, and there is one channel. A delta filter leaves the grid unchanged before selecting the first position; W therefore has shape 1 by 4.
Source: Source expression