Documentos de Académico
Documentos de Profesional
Documentos de Cultura
Read Ch. 4] Recommended exercises 4.1, 4.2, 4.5, 4.9, 4.11] Threshold units Gradient descent Multilayer networks Backpropagation Hidden layer representations Example: Face Recognition Advanced topics
74
Connectionist Models
Consider humans: Neuron switching time ~ :001 second Number of neurons ~ 10 Connections per neuron ~ 10 ? Scene recognition time ~ :1 second 100 inference steps doesn't seem like enough ! much parallel computation
10 4 5
Properties of arti cial neural nets (ANN's): Many neuron-like threshold switching units Many weighted interconnections among units Highly parallel, distributed process Emphasis on tuning weights automatically
75
76
Sharp Left
Straight Ahead
Sharp Right
30 Output Units
4 Hidden Units
77
Perceptron
x1 x2 w1 w2 x0=1 w0
. . .
xn
wn
i=0
wi xi
o=
1 if
i=0 -1 otherwise
wi xi > 0
+ wnxn > 0
Sometimes we'll use simpler vector notation: 8 > 1 if w ~ > 0 ~ x o(~ ) = < ?1 otherwise. x > :
78
(a)
(b)
But some functions not representable e.g., not linearly separable Therefore, we'll want networks of these...
79
where
Where: t = c(~ ) is target value x o is perceptron output is small constant (e.g., .1) called learning rate
wi = (t ? o)xi
80
81
Gradient Descent
To understand, consider simpler linear unit, where o = w + w x + + w n xn Let's learn wi's that minimize the squared error E w] 2 d2D(td ? od) ~ 1X Where D is set of training examples
0 1 1 2
82
Gradient Descent
25 20 15
E[w]
10 5 0 2 1 -2 0 1 -1 2 3 w1 w0 -1 0
Gradient
rE w] ~
2 6 4
@E ; @E ; @w @w
0 1
@E 3 7 5 @wn
w = ? rE w] ~ ~ @E wi = ? @w i
Machine Learning, T. Mitchell, McGraw Hill, 1997
83
Gradient Descent
@E = @ 1 X(t ? o ) @wi @wi 2 d d d 1 X @ (t ? o ) = 2 d @w d d i @ 1 = 2 X 2(td ? od) @w (td ? od) d i @ (t ? w x ) X = d (td ? od) @w d ~ ~d i @E = X(t ? o )(?x ) @wi d d d i;d
2 2
84
Gradient Descent
Gradient-Descent
(training examples; ) Each training example is a pair of the form h~ ; ti, where ~ is the vector of input values, x x and t is the target output value. is the learning rate (e.g., .05). Initialize each wi to some small random value Until the termination condition is met, Do { Initialize each wi to zero. { For each h~ ; ti in training examples, Do x Input the instance ~ to the unit and x compute the output o For each linear unit weight wi, Do wi wi + (t ? o)xi { For each linear unit weight wi, Do wi w i + w i
85
Summary
Perceptron training rule guaranteed to succeed if Training examples are linearly separable Su ciently small learning rate Linear unit training rule uses gradient descent Guaranteed to converge to hypothesis with minimum squared error Given su ciently small learning rate Even when training data contains noise Even when training data not separable by H
86
87
head hid
...
...
whod hood
F1
F2
88
Sigmoid Unit
x1 x2 w1 w2 x0 = 1 w0
. . .
xn
wn
net = wi xi
i=0
o = (net) =
1 1+e
-net
(x) is the sigmoid function 1 1 + e?x Nice property: d dxx = (x)(1 ? (x)) We can derive gradient decent rules to train One sigmoid unit Multilayer networks of sigmoid units ! Backpropagation
( )
89
90
Backpropagation Algorithm
Initialize all weights to small random numbers. Until satis ed, Do For each training example, Do 1. Input the training example to the network and compute the network outputs 2. For each output unit k ok(1 ? ok )(tk ? ok ) k 3. For each hidden unit h oh(1 ? oh) X wh;k k h 4. Update each network weight wi;j wi;j wi;j + wi;j where wi;j = j xi;j
k2outputs
91
More on Backpropagation
Gradient descent over entire network weight vector Easily generalized to arbitrary directed graphs Will nd a local, not necessarily global error minimum { In practice, often works well (can run multiple times) Often include weight momentum wi;j(n) = j xi;j + wi;j (n ? 1) Minimizes error over training examples { Will it generalize well to subsequent examples? Training can take thousands of iterations ! slow! Using network after training is very fast
92
A target function: Input 10000000 01000000 00100000 00010000 00001000 00000100 00000010 00000001
! ! ! ! ! ! ! !
93
Learned hidden layer representation: Input Hidden Output Values 10000000 ! .89 .04 .08 ! 10000000 01000000 ! .01 .11 .88 ! 01000000 00100000 ! .01 .97 .27 ! 00100000 00010000 ! .99 .97 .71 ! 00010000 00001000 ! .03 .05 .02 ! 00001000 00000100 ! .22 .99 .99 ! 00000100 00000010 ! .80 .01 .98 ! 00000010 00000001 ! .60 .94 .01 ! 00000001
Machine Learning, T. Mitchell, McGraw Hill, 1997
94
Training
Sum of squared errors for each output unit 0.9 0.8 0.7 0.6 0.5 0.4 0.3 0.2 0.1 0 0 500 1000 1500 2000 2500
95
Training
Hidden unit encoding for input 01000000 1 0.9 0.8 0.7 0.6 0.5 0.4 0.3 0.2 0.1 0 500 1000 1500 2000 2500
96
Training
Weights from inputs to one hidden unit 4 3 2 1 0 -1 -2 -3 -4 -5 0 500 1000 1500 2000 2500
97
Convergence of Backpropagation
Gradient descent to some local minimum Perhaps not global minimum... Add momentum Stochastic gradient descent Train multiple nets with di erent inital weights Nature of convergence Initialize weights near zero Therefore, initial networks near-linear Increasingly non-linear functions possible as training progresses
98
99
Error
0.006 0.005 0.004 0.003 0.002 0 5000 10000 15000 Number of weight updates 20000
Error versus weight updates (example 2) 0.08 0.07 0.06 0.05 Training set error Validation set error
Error
0.04 0.03 0.02 0.01 0 0 1000 2000 3000 4000 Number of weight updates 5000 6000
100
...
...
30x32 inputs
Typical input images 90% accurate learning head pose, and recognizing 1-of-20 faces
101
...
...
30x32 inputs
102
103
Recurrent Networks
y(t + 1) y(t + 1)
x(t)
c(t)
y(t + 1)
x(t)
c(t) y(t)
x(t 1)
c(t 1) y(t 1)
x(t 2)
c(t 2)
unfolded in time
104