SECTION 04 / 4

Representation Power of a Network of Sigmoid Neurons

6 min read
On this page 7 headings
BUILD INTUITION WITH NUMBERS

Make a bump with two sigmoid steps

Subtract a steep sigmoid centred at 3 from one centred at 1. Use a steepness of 100.

  1. Define the bump.

    T(x)=σ(100(x−1))−σ(100(x−3))T(x)=\sigma(100(x-1))-\sigma(100(x-3))
  2. Between the two centres, the first sigmoid is near 1 and the second is near 0.

    T(2)=σ(100)−σ(−100)≈1T(2)=\sigma(100)-\sigma(-100)\approx1
  3. Before both centres, both sigmoid outputs are near 0.

    T(0)=σ(−100)−σ(−300)≈0T(0)=\sigma(-100)-\sigma(-300)\approx0

What changed? Two smooth steps create an approximate rectangular bump. Adding many such bumps can approximate a curve. Values are approximate, not exact hard steps.

Quick check: What is the bump approximately at x = 4?

0: both sigmoid outputs are near 1, so they nearly cancel.

Swipe long formulas, tables or code sideways to see the rest.

Start here In Week 1, a network of perceptrons could represent any Boolean function exactly. Now the big claim: a network of sigmoid neurons with just one hidden layer can approximate any continuous function as closely as we like. The idea is like building a curve out of Lego bricks — and each brick is made from two sigmoids.

1. The theorem (Universal Approximation)

Network of perceptrons Network of sigmoid neurons
One hidden layer can represent any Boolean function precisely (no errors) One hidden layer can approximate any continuous function to any desired precision

In other words: for any function f(x):Rn→Rmf(x): \mathbb{R}^{n} \to \mathbb{R}^{m}, we can always find a neural network (1 hidden layer with enough neurons) whose output g(x) satisfies

∣g(x)−f(x)∣<ϵ|g(x) - f(x)| < \epsilon for any small ε we choose.

This is from Cybenko (1989) and Hornik (1991). The lecture gives an illustrative proof, based on the online book Neural Networks and Deep Learning (Michael Nielsen, chapter 4).

2. Idea: approximate any curve with “towers”

Take any wiggly function. Cover it with many thin rectangular towers (like a bar chart).

  • Each tower is shifted to its position and scaled to the function’s height there.
  • Adding them up gives an approximation of the function.
  • More towers (thinner) → better approximation.
A few towers give a rough fit; many thin towers give a close fit.
A few towers give a rough fit; many thin towers give a close fit.
Open image ↗
A smooth curve covered first by a few wide towers, then by many thin towers that fit it closely

So imagine a black box of “tower makers”: each one takes x and produces one tower. A simple network then adds the towers. Our job: find out what is inside a tower maker.

3. A tower from two sigmoids

Step 1 — a very steep sigmoid is a step. Inσ(wx+b)In \sigma (wx + b), if w is very large (say 50), the S-curve becomes almost vertical: a step. The step happens where wx+b=0,iwx + b = 0, i.e. at x=−b/wx = -b/w. So b controls where the step is.

Step 2 — subtract two steps.

  • h11=σ(50(x−1))→h_{11} = \sigma (50(x - 1)) \to steps up at x=1(w=50,b=−50)x = 1 (w = 50, b = -50)
  • h12=σ(50(x−3))→h_{12} = \sigma (50(x - 3)) \to steps up at x=3(w=50,b=−150)x = 3 (w = 50, b = -150)
  • h21=h11−h12h_{21} = h_{11} - h_{12} → 0 before 1, 1 between 1 and 3, 0 after 3. A tower!
A step at 1 minus a step at 3 = a tower from 1 to 3.
A step at 1 minus a step at 3 = a tower from 1 to 3.
Open image ↗
Two steep sigmoids at x = 1 and x = 3; subtracting them leaves a tower between 1 and 3

As a network: input x → two sigmoid hidden neurons (h11h_{11} with w1,b1;h12w_{1}, b_{1}; h_{12} with w2,b2w_{2}, b_{2}) → one output neuron h21h_{21} with weights +1 and −1.

What activation should h21useh_{21} use? It just needs to add+1⋅h11−1⋅h12add +1\cdot h_{11} - 1\cdot h_{12}, so a linear (identity) output works.

Check at a few points (x→h11,h12,h21)(x \to h_{11}, h_{12}, h_{21}):

x h11=σ(50(x−1))h_{11} = \sigma (50(x - 1)) h12=σ(50(x−3))h_{12} = \sigma (50(x - 3)) h21h_{21}
0 σ(−50)≈0\sigma (-50) \approx 0 σ(−150)≈0\sigma (-150) \approx 0 0
2 σ(50)≈1\sigma (50) \approx 1 σ(−50)≈0\sigma (-50) \approx 0 1
4 σ(150)≈1\sigma (150) \approx 1 σ(50)≈1\sigma (50) \approx 1 0

4. More than one input: the oil example

Lecture example — finding oil Decide whether there is oil at a location on the ocean bed (yes/no), using two factors: salinity (x1)(x_{1}) and pressure (x2)(x_{2}). The data shows that y ∈ {oil, no oil} is a complex function of x1x_{1} and x2x_{2}. We want a network to approximate it — so we need towers in 2-D.

The neuron is now f(x1,x2)=11+exp⁡(−(w1x1+w2x2+b))f(x_{1}, x_{2}) = \frac{1}{1 + \exp (-(w_{1}x_{1} + w_{2}x_{2} + b))}.

  • Vary w1w_{1} (with w2=0,b=0w_{2} = 0, b = 0): the S-curve rises along the x1x_{1} direction; large w1→aw_{1} \to a step “wall” along x1x_{1}.
  • Vary w2w_{2} (with w1=0,b=0w_{1} = 0, b = 0): same along x2x_{2}.
  • Vary b (with w1=k,w2=0w_{1} = k, w_{2} = 0): the wall slides to a different position.

Building the 2-D tower:

  1. Two steep sigmoids in the x1x_{1} direction (different b), subtracted → a wall open on two sides (a long ridge, not a tower).
  2. Two more in the x2x_{2} direction, subtracted → another ridge, crossing the first.
  3. Add the two ridges → height 2 where they cross (the centre), height 1 on the arms, 0 elsewhere.
  4. Pass this sum through one more steep sigmoid with a threshold between 1 and 2 (the lecture uses w=50,b=−100,iw = 50, b = -100, i.e. fires when the sum is about ≥2\ge 2) → only the centre survives: a closed tower.
Two ridges cross; a final threshold keeps only the square tower where they overlap.
Two ridges cross; a final threshold keeps only the square tower where they overlap.
Open image ↗
Four sigmoids in x1 and x2 make two crossing ridges; a final sigmoid keeps only the closed tower in the middle

Lecture example — the 2-D tower network Four sigmoid hidden units. h11h_{11} and h12putabigh_{12} put a big weight (200) on x1x_{1} and a small weight (6) on x2;h13x_{2}; h_{13} and h14puth_{14} put the big weight (±200) on x2x_{2} and 6 on x1x_{1}. A linear unit computes h11−h12h_{11} - h_{12} (the x1x_{1} ridge), another computes h13−h14h_{13} - h_{14} (the x2x_{2} ridge). These two are added with weights +1, +1. The final sigmoid has w=50,b=−100w = 50, b = -100, so it outputs ≈1\approx 1 only where the sum is about 2 or more — the centre where both ridges overlap.

5. How many neurons per tower?

Input dimension Neurons to make one tower
1 2 (one pair of steps)
2 4 (two pairs) + the closing sigmoid
n 2n (n pairs), plus the closing unit

(The lecture leaves “n dimensions” as a “think” question; following the same pattern — one pair of opposite steps for each input direction — gives 2n sigmoid neurons per tower, plus the final thresholding unit.)

The catch: to approximate a complex function well you need many towers, so the hidden layer can become very large. The theorem says such a network exists — not that it is small, or easy to learn.

In one line: Steep sigmoids make steps, two steps make a tower, and enough towers added together approximate any continuous function — so one hidden layer of sigmoid neurons is a universal approximator.

Exam words: representation power, universal approximation theorem, Cybenko 1989, Hornik 1991,∣g(x)−f(x)∣<ϵ1991, |g(x) - f(x)| < \epsilon , tower function, step function from large w,x=−b/ww, x = -b/w, linear output neuron, 2-D tower.

Quick check

  1. Where does σ(20x−60)\sigma (20x - 60) step up?
Where 20x−60=0,i20x - 60 = 0, i.e. x=3x = 3.
  1. Which two sigmoids give a tower from x=2x = 2 to x=5x = 5 (using w=100w = 100)?
σ(100(x−2))−σ(100(x−5)),i\sigma (100(x - 2)) - \sigma (100(x - 5)), i.e. biases −200 and −500.
  1. Does the theorem say the network will be small?
No. It only guarantees that a network with enough hidden neurons exists. It may need very many.
  1. Perceptron network vs sigmoid network: exact or approximate?
Perceptron network: exact, for Boolean functions. Sigmoid network: approximate (to any precision ε), for continuous functions.
  1. Why is one pair of x1−x_{1}-sigmoids not enough for a 2-D tower?
It only limits x1x_{1}. Along x2x_{2} the wall goes on forever (open on two sides). A second pair along x2x_{2} and a final threshold are needed to close it.
YOUR STUDY PROGRESS

Finished this section? Save your progress.

Back to top ↑