Bias as an extra coordinate
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.
Features · Transform inputs into features used by a rule.
The project scales bill and flipper measurements using training-row means and scales; its feature vector has two entries.
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: 1.2 Learning from examples
Appending 1 to the input lets a matrix multiplication include the bias.
This representation simplifies layer notation.
Source formula example
exact · This is a concrete finite-dimensional example of the source transformation.
Symbols
- Input vector.
- Weight matrix.
- Bias vector.
- Number of layers.
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.x= 1
Initial values in code
W=[ [1, 2], [3, 4], ]b=[1, -1]augmented=[ [1, 2, 1], [3, 4, -1], [0, 0, 1], ]
Calculated here
Result expression: { augmentedInput, augmented, hiddenOutput: full, finalOutput: finalLayer }
x=[input.x, 2]Uses:input.xaugmentedInput=[...x, 1]Uses:xfull=augmented.map((row) => row.reduce((s, v, i) => s + v * augmentedInput[i], 0), )Uses:augmented,augmentedInputfinalLayer=[ [1, 2, 1], [3, 4, -1], ].map((row) => row.reduce((s, v, i) => s + v * augmentedInput[i], 0))Uses:augmentedInput
Returns
augmentedInput- array (3 items): [1, 2, 1]
augmented- array (3 items): [array (3 items): [1, 2, 1], array (3 items): [3, 4, -1], array (3 items): [0, 0, 1]]
hiddenOutput- array (3 items): [6, 10, 1]
finalOutput- array (2 items): [6, 10]
Read numbers from input and return the result. JavaScript basics.
Result
Technical statement
The extra row preserves the constant 1 for intermediate layers; the final layer does not include that row.
Source: Source expression