Open Agent School · Public worked example

Linear layer: meaning and example

Welcome! Take one idea with you today.

A linear layer mixes input features with weights and adds a bias for each output. Libraries usually call this a linear layer, although adding a nonzero bias makes the transformation affine: it can shift as well as scale and mix.

Picture it: A tiny model predicts minutes from distance using weight 2 and bias 5. A distance of 3 gives 11 minutes. The 5-minute bias represents a fixed preparation allowance in this toy rule, not a discovered causal law.

What is easy to mix up?

A strictly linear map sends zero to zero. An affine layer can send zero to its bias; this distinction matters when interpreting a model.

Teaching example by Open Agent School. Source: Dive into Deep Learning: Multilayer Perceptrons.