3.1.13 · D3Neural Network Fundamentals

Worked examples — Bias terms and their role

2,069 words9 min readBack to topic

This page is the "exhaustive drill" companion to the bias topic (the parent). Read that first if you have not — here we assume you know the one line where is the pre-activation (the number the neuron computes before squashing it), is the list of weights (one multiplier per input), is the list of inputs, and is the bias (a single added number). Everything below is a chase through every kind of case this formula can produce.


The scenario matrix

Every case this topic can throw at you falls into one of these cells. Each worked example is tagged with the cell(s) it covers.

Cell What varies Example(s)
A Positive bias — line/threshold shifts one way Ex 1
B Negative bias — line/threshold shifts the other way Ex 2
C Zero bias (degenerate) — forced through origin Ex 3
D Zero input all , only bias survives Ex 3, Ex 4
E Multi-input neuron are vectors, threshold is a plane Ex 4
F Sign of the gradient positive vs negative → goes down vs up Ex 5
G Limiting behaviour / for sigmoid Ex 6
H Real-world word problem translate a story into Ex 7
I Exam twist "", threshold algebra, negative Ex 8
J Minibatch gradient average of per-example 's Ex 9

Two symbols we will lean on:

  • — the sigmoid, an S-shaped squasher that maps any real into . See Activation functions (sigmoid, ReLU, tanh). It equals exactly when , because then and .
  • — the neuron's error signal, the sensitivity of the loss to the pre-activation. From the parent, .
Figure — Bias terms and their role

Example 1 — Positive bias shifts the line up (Cell A)


Example 2 — Negative bias shifts the line down (Cell B)


Example 3 — Zero bias & zero input: the degenerate cell (Cells C, D)


Example 4 — Multi-input neuron: bias shifts a plane (Cell E, D)

Figure — Bias terms and their role

Example 5 — Sign of the bias gradient (Cell F)


Example 6 — Limiting behaviour of a sigmoid bias (Cell G)

Figure — Bias terms and their role

Example 7 — Real-world word problem (Cell H)


Example 8 — Exam twist: negative weight & the formula (Cell I)


Example 9 — Minibatch bias gradient (Cell J)


Recall Checks

Recall In Example 3, what is the best possible loss of the bias-free model?

— the point contributes no matter what is, since .

Recall In Example 8, why does the neuron fire for

small ? Because is negative; dividing the inequality by flips it to . Sign of sets the firing direction; sets the location.

Recall Why is the batch bias gradient just the mean of the

's (not input-weighted)? Because for every example, so each contributes ; averaging gives .


Connections