Features, Gram matrix and gradient
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.
Kernels and linearization · Relate parameter gradients or features to kernel matrices.
The project supplies finite observations and fitted parameters. A held-out sample does not establish population bounds or prove a theorem.
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: 5.2 When parameters move only a little
A feature vector contains one hidden unit’s value on each example. Add its outer product for each unit to make the Gram matrix.
These quantities connect network parameters to loss and optimization.
Source formula example
illustration · The invented finite inputs illustrate this expression. They do not prove a general identity, bound, or existence claim.
Symbols
- m by m output-weight gradient Gram matrix.
- Length-m vector of hidden feature k on the training inputs.
- Positive integers: hidden units and training examples.
- Network parameters at initialization.
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.feature= 2
Initial values in code
errors=[1, 1]
Calculated here
Result expression: { gram, quadratic, outputWeightGradientSquared: quadratic }
features=[ [1, 0], [0, input.feature], ]Uses:input.featuregram=features.map((a) => features.map((b) => a.reduce((sum, v, i) => sum + v * b[i], 0)), )Uses:featuresquadratic=errors.reduce( (sum, e, i) => sum + e * gram[i].reduce((a, v, j) => a + v * errors[j], 0), 0, )Uses:errors,gram
Returns
gram- array (2 items): [array (2 items): [1, 0], array (2 items): [0, 4]]
quadratic- 5
outputWeightGradientSquared- 5
Read numbers from input and return the result. JavaScript basics.
Result
Technical statement
There are two examples, so the squared-loss gradient factor 4/m² equals 1. The Gram matrix is formed from the feature vectors across examples; equivalently, it is the inner-product matrix of the per-example output-weight gradients.
Source: Source expression