Swipe long formulas, tables or code sideways to see the rest.
Start here All of Week 2 on one page: sigmoid
neuron, the learning setup, gradient descent, and the universal
approximation idea.
- The perceptron’s step is harsh (0.49 → no, 0.51 →
yes) and not differentiable.
- The sigmoid (logistic) neuron σ(z)=1+e−z1 is smooth, differentiable, and outputs a probability in (0, 1).
- Supervised learning = data + model + parameters + learning
algorithm + loss. Guessing parameters doesn’t scale.
- Gradient descent: move opposite to the gradient (β=180∘) in small steps η.
- Universal approximation: one hidden layer of
sigmoid neurons (enough of them) can approximate any continuous function
to any precision — towers built from pairs of steep sigmoids.
| Idea |
Formula |
| Sigmoid |
σ(z)=1+e−z1,σ(0)=0.5,σ(−z)=1−σ(z) |
| Model |
f(x)=1+e−(wx+b)1 |
| Squared-error loss |
L(w,b)=(1/N)∑i(yi−f(xi))2 (lecture code uses 21∑) |
| Taylor (first order) |
L(θ+ηu)≈L(θ)+ηuT∇θL(θ) |
| Best direction |
u=−∇L(cosβ=−1,β=180∘) |
| Update |
w←w−η∇w,b←b−η∇b |
| Gradients (one point, ½ squared error) |
∇w=(f−y)f(1−f)x;∇b=(f−y)f(1−f) |
| Step from a sigmoid |
large w; step at x=−b/w |
| Tower |
σ(w(x−a))−σ(w(x−c)) |
| Neurons per tower |
1-D: 2; 2-D: 4 (+1 to close); n-D: 2n (+1) |
- Two-point example (0.5, 0.2), (2.5, 0.9): best w≈1.79,b≈−2.28, loss 0.
- Guess w=3,b=−1→ loss ≈0.0941.
- GD from (−2,−2),η=1: very slow at first (flat region), loss ≈0.0177 after 100 steps, ≈0 after 1000.
- Don’t forget the minus sign in the update: a
negative gradient makes the weight increase.
- ∇b has no x factor; ∇w has the x factor.
- Sum the gradient over all points for (batch)
gradient descent.
- The theorem is about approximation (∣g−f∣<ϵ), not exact representation, and says nothing about how small the network is or how easy it is to train.
- Perceptron network → Boolean functions
exactly; sigmoid network → continuous
functions approximately.
Exam words: sigmoid, logistic, differentiable,
supervised learning, model, parameters, loss, error surface, gradient
descent, learning rate, Taylor series, universal approximation, tower
function, Cybenko, Hornik.
- What does a very large w do to σ(wx+b)?
It makes the S-curve almost vertical — practically a step function at x=−b/w.
- f=0.8,y=0.2,x=1.∇w?
(0.8−0.2)×0.8×0.2×1=0.6×0.16=0.096.
- Name the five parts of the supervised ML setup.
Data, model, parameters, learning algorithm, loss (objective/error)
function.
- Why is plotting the error surface not a practical learning method?
Real networks have millions of parameters; trying all combinations is
intractable, and each parameter ranges over all real numbers.
- How many sigmoid neurons make one 1-D tower?
Two (one step up, one step down), combined by a linear output with
weights +1 and −1.