cse 5526: introduction to neural networksmr-pc.org/t/cse5526/pdf/04b-review.pdf · 2020-05-06 ·...

58
1 CSE 5526: Review CSE 5526: Introduction to Neural Networks Review to date

Upload: others

Post on 20-May-2020

21 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: CSE 5526: Introduction to Neural Networksmr-pc.org/t/cse5526/pdf/04b-review.pdf · 2020-05-06 · CSE 5526: Review 2 Real neurons have three main parts • Cell body (~50µm) •

1 CSE 5526: Review

CSE 5526: Introduction to Neural Networks

Review to date

Page 2: CSE 5526: Introduction to Neural Networksmr-pc.org/t/cse5526/pdf/04b-review.pdf · 2020-05-06 · CSE 5526: Review 2 Real neurons have three main parts • Cell body (~50µm) •

2 CSE 5526: Review

Real neurons have three main parts

• Cell body (~50µm) • Initiates action potential

• Axon (0.2-20µm) • Transmits signal to up to 1000

other neurons • Insulated by myelin sheath • Up to 1m long

• Dendrites: receive signals • Synapse: junction to another

neuron’s axon

Page 3: CSE 5526: Introduction to Neural Networksmr-pc.org/t/cse5526/pdf/04b-review.pdf · 2020-05-06 · CSE 5526: Review 2 Real neurons have three main parts • Cell body (~50µm) •

3 CSE 5526: Review

This model approximates the neural firing rate

Page 4: CSE 5526: Introduction to Neural Networksmr-pc.org/t/cse5526/pdf/04b-review.pdf · 2020-05-06 · CSE 5526: Review 2 Real neurons have three main parts • Cell body (~50µm) •

4 CSE 5526: Review

McCulloch-Pitts neuron model

}1,1{ −∈ix

)(1

bxwy i

m

ii += ∑

=

ϕ

0 if0 if

11

)(<≥

=vv

vϕ A form of signum (sign) function

Bipolar input

Page 5: CSE 5526: Introduction to Neural Networksmr-pc.org/t/cse5526/pdf/04b-review.pdf · 2020-05-06 · CSE 5526: Review 2 Real neurons have three main parts • Cell body (~50µm) •

5 CSE 5526: Review

M-P neurons can implement any logic function

𝑥𝑥1

𝑥𝑥2

𝑦𝑦

𝑥𝑥1 𝑥𝑥2 𝑥𝑥1AND 𝑥𝑥2 𝑥𝑥1OR 𝑥𝑥2 NOT 𝑥𝑥1 -1 -1 -1 -1 1 -1 1 -1 1 1 1 -1 -1 1 -1 1 -1 1 1 -1

1

𝑤𝑤1

𝑤𝑤2

𝑏𝑏

Σ

𝑥𝑥1AND 𝑥𝑥2 𝑥𝑥1OR 𝑥𝑥2 NOT 𝑥𝑥1 𝑤𝑤1 1 1 -1 𝑤𝑤2 1 1 0 𝑏𝑏 -0.5 0.5 0

𝑦𝑦 = 𝑤𝑤1𝑥𝑥1 + 𝑤𝑤2𝑥𝑥2 + 𝑏𝑏

Page 6: CSE 5526: Introduction to Neural Networksmr-pc.org/t/cse5526/pdf/04b-review.pdf · 2020-05-06 · CSE 5526: Review 2 Real neurons have three main parts • Cell body (~50µm) •

6 CSE 5526: Review

M-P neurons have a linear decision boundary

• Can we visualize the decision the perceptron would make in classifying every potential point?

• Yes, it is called the discriminant function

𝑔𝑔 𝑥𝑥 = 𝑥𝑥𝑇𝑇𝑤𝑤 = �𝑤𝑤𝑖𝑖𝑥𝑥𝑖𝑖

𝑚𝑚

𝑖𝑖=0

• What is the boundary between the two classes like? 𝑔𝑔 𝑥𝑥 = 𝑥𝑥𝑇𝑇𝑤𝑤 = 0

• This is a linear function of x

Page 7: CSE 5526: Introduction to Neural Networksmr-pc.org/t/cse5526/pdf/04b-review.pdf · 2020-05-06 · CSE 5526: Review 2 Real neurons have three main parts • Cell body (~50µm) •

7 CSE 5526: Review

M-P neurons have a linear decision boundary

Page 8: CSE 5526: Introduction to Neural Networksmr-pc.org/t/cse5526/pdf/04b-review.pdf · 2020-05-06 · CSE 5526: Review 2 Real neurons have three main parts • Cell body (~50µm) •

8 CSE 5526: Review

Linear decision functions can’t solve all classification problems

Linearly separable Non-linearly separable

Not separable

Distinction depends on “scale” of classifier

Page 9: CSE 5526: Introduction to Neural Networksmr-pc.org/t/cse5526/pdf/04b-review.pdf · 2020-05-06 · CSE 5526: Review 2 Real neurons have three main parts • Cell body (~50µm) •

9 CSE 5526: Review

Perceptron algorithm learns weights from data

• Learn parameters w from examples (xp, dp) • In an online fashion, i.e., one point at a time • Adjust weights as necessary, i.e. when incorrect • Adjust weights to be more like d=1 points and more

like negative d=-1 points

Page 10: CSE 5526: Introduction to Neural Networksmr-pc.org/t/cse5526/pdf/04b-review.pdf · 2020-05-06 · CSE 5526: Review 2 Real neurons have three main parts • Cell body (~50µm) •

10 CSE 5526: Review

Perceptron algorithm learns weights from data

)()()1( nwnwnw ∆+=+

n: iteration number, iterating over points in turn η: step size or learning rate, = 1 WLOG Only updates w when y(n) is incorrect

)()]()([)( nxnyndnw −+= η

Page 11: CSE 5526: Introduction to Neural Networksmr-pc.org/t/cse5526/pdf/04b-review.pdf · 2020-05-06 · CSE 5526: Review 2 Real neurons have three main parts • Cell body (~50µm) •

11 CSE 5526: Review

Visualization of perceptron learning

From Bishop (2006)

Page 12: CSE 5526: Introduction to Neural Networksmr-pc.org/t/cse5526/pdf/04b-review.pdf · 2020-05-06 · CSE 5526: Review 2 Real neurons have three main parts • Cell body (~50µm) •

12 CSE 5526: Review

Visualization of perceptron learning

From Bishop (2006)

Page 13: CSE 5526: Introduction to Neural Networksmr-pc.org/t/cse5526/pdf/04b-review.pdf · 2020-05-06 · CSE 5526: Review 2 Real neurons have three main parts • Cell body (~50µm) •

13 CSE 5526: Review

Visualization of perceptron learning

From Bishop (2006)

Page 14: CSE 5526: Introduction to Neural Networksmr-pc.org/t/cse5526/pdf/04b-review.pdf · 2020-05-06 · CSE 5526: Review 2 Real neurons have three main parts • Cell body (~50µm) •

14 CSE 5526: Review

Visualization of perceptron learning

From Bishop (2006)

Page 15: CSE 5526: Introduction to Neural Networksmr-pc.org/t/cse5526/pdf/04b-review.pdf · 2020-05-06 · CSE 5526: Review 2 Real neurons have three main parts • Cell body (~50µm) •

15 CSE 5526: Review

Visualization of perceptron learning

From Bishop (2006)

Page 16: CSE 5526: Introduction to Neural Networksmr-pc.org/t/cse5526/pdf/04b-review.pdf · 2020-05-06 · CSE 5526: Review 2 Real neurons have three main parts • Cell body (~50µm) •

16 CSE 5526: Review

Summary of perceptron learning algorithm

• Definition • w(n): (m+1)-by-1 weight vector (including bias) at step n

• Inputs • x(n): nth (m+1)-by-1 input vector with first element = 1 • d(n): nth desired response

• Initialization: set w(0) = 0 • Repeat until no points are mis-classified

• Compute response: 𝑦𝑦 𝑛𝑛 = signum 𝑤𝑤 𝑛𝑛 𝑇𝑇𝑥𝑥 𝑛𝑛 • Update: 𝑤𝑤 𝑛𝑛 + 1 = 𝑤𝑤 𝑛𝑛 + 𝑑𝑑 𝑛𝑛 − 𝑦𝑦 𝑛𝑛 𝑥𝑥(𝑛𝑛)

Page 17: CSE 5526: Introduction to Neural Networksmr-pc.org/t/cse5526/pdf/04b-review.pdf · 2020-05-06 · CSE 5526: Review 2 Real neurons have three main parts • Cell body (~50µm) •

17 CSE 5526: Review

Perceptron learning can be interpreted as gradient descent

• Consider the total amount by which a neuron mis-classifies all of the points

𝐸𝐸 𝑤𝑤 = −� 𝑑𝑑𝑝𝑝 − 𝑦𝑦𝑝𝑝 𝑤𝑤𝑇𝑇𝑥𝑥𝑝𝑝𝑝𝑝

• Then the gradient of this WRT 𝑤𝑤 is

𝛻𝛻𝑤𝑤𝐸𝐸 𝑤𝑤 = −� 𝑑𝑑𝑝𝑝 − 𝑦𝑦𝑝𝑝 𝑥𝑥𝑝𝑝𝑝𝑝

• So the gradient descent update is 𝑤𝑤 𝑛𝑛 + 1 = 𝑤𝑤 𝑛𝑛 − 𝜂𝜂𝛻𝛻𝑤𝑤𝐸𝐸 = 𝑤𝑤 𝑛𝑛 + 𝑑𝑑𝑝𝑝 − 𝑦𝑦𝑝𝑝 𝑥𝑥𝑝𝑝

Page 18: CSE 5526: Introduction to Neural Networksmr-pc.org/t/cse5526/pdf/04b-review.pdf · 2020-05-06 · CSE 5526: Review 2 Real neurons have three main parts • Cell body (~50µm) •

18 CSE 5526: Review

Perceptron convergence theorem

• Theorem: • Assume that there exists some unit vector w0 and some α

such that 𝑑𝑑 𝑛𝑛 𝑤𝑤0𝑇𝑇𝑥𝑥 𝑛𝑛 ≥ 𝛼𝛼 – i.e., the data are linearly separable

• Assume also that there exists some R such that 𝑥𝑥 𝑛𝑛 = 𝑥𝑥 𝑛𝑛 𝑇𝑇𝑥𝑥 𝑛𝑛 ≤ 𝑅𝑅 ∀𝑛𝑛 – i.e., the data lie within a sphere of radius R

• Then the perceptron algorithm makes at most 𝑅𝑅2

𝛼𝛼2 errors

– i.e., it converges in at most 𝑅𝑅2

𝛼𝛼2 iterations

Page 19: CSE 5526: Introduction to Neural Networksmr-pc.org/t/cse5526/pdf/04b-review.pdf · 2020-05-06 · CSE 5526: Review 2 Real neurons have three main parts • Cell body (~50µm) •

19 CSE 5526: Review

Perceptron convergence proof sketch

• Define 𝑤𝑤𝑘𝑘 as the parameter vector when the algorithm makes its kth error (note 𝑤𝑤1 = 0)

• First show 𝑘𝑘𝛼𝛼 ≤ 𝑤𝑤𝑘𝑘+1 by induction • The weight vector grows in length proportionally with 𝑘𝑘 • because of the separability of the data

• Second show 𝑤𝑤𝑘𝑘+1 2 ≤ 𝑘𝑘𝑅𝑅2 by induction • But it can grow no faster than 𝑘𝑘 • because of the radius of the data

• Then it follows that 𝑘𝑘 ≤ 𝑅𝑅2/𝛼𝛼2 • The perceptron makes a finite number of errors

Page 20: CSE 5526: Introduction to Neural Networksmr-pc.org/t/cse5526/pdf/04b-review.pdf · 2020-05-06 · CSE 5526: Review 2 Real neurons have three main parts • Cell body (~50µm) •

20 CSE 5526: Review

The double-moon classification problem

Page 21: CSE 5526: Introduction to Neural Networksmr-pc.org/t/cse5526/pdf/04b-review.pdf · 2020-05-06 · CSE 5526: Review 2 Real neurons have three main parts • Cell body (~50µm) •

21 CSE 5526: Review

Perceptron learns double-moon, d = 1

Page 22: CSE 5526: Introduction to Neural Networksmr-pc.org/t/cse5526/pdf/04b-review.pdf · 2020-05-06 · CSE 5526: Review 2 Real neurons have three main parts • Cell body (~50µm) •

22 CSE 5526: Review

Perceptron does not learn double-moon, d = -4

Page 23: CSE 5526: Introduction to Neural Networksmr-pc.org/t/cse5526/pdf/04b-review.pdf · 2020-05-06 · CSE 5526: Review 2 Real neurons have three main parts • Cell body (~50µm) •

23 CSE 5526: Review

Linear regression has a closed-form solution

• Predict desired output 𝑑𝑑𝑝𝑝 • As a linear function of observations, 𝒙𝒙𝑝𝑝

𝑦𝑦𝑝𝑝 = 𝒘𝒘𝑇𝑇𝒙𝒙𝑝𝑝 • Find parameters 𝒘𝒘 that minimize the mean square

error of the predictions

𝐸𝐸 𝒘𝒘 =12� 𝑑𝑑𝑝𝑝 − 𝑦𝑦𝑝𝑝

2

𝑝𝑝

• Set gradient of error WRT 𝒘𝒘 to 0 • Solve for 𝒘𝒘 analytically

Page 24: CSE 5526: Introduction to Neural Networksmr-pc.org/t/cse5526/pdf/04b-review.pdf · 2020-05-06 · CSE 5526: Review 2 Real neurons have three main parts • Cell body (~50µm) •

24 CSE 5526: Review

The mean square error defines a parabolic cost function

w

E(w)

w*

Emin

w0

Page 25: CSE 5526: Introduction to Neural Networksmr-pc.org/t/cse5526/pdf/04b-review.pdf · 2020-05-06 · CSE 5526: Review 2 Real neurons have three main parts • Cell body (~50µm) •

25 CSE 5526: Review

Optimal parameters can be found via search

• Often there is no closed form solution for 𝛻𝛻𝒘𝒘𝐸𝐸 𝒘𝒘 = 0

• We can still use the gradient in a numerical solution • This is called gradient descent

𝒘𝒘 𝑛𝑛 + 1 = 𝒘𝒘 𝑛𝑛 − 𝜂𝜂𝛻𝛻𝒘𝒘𝐸𝐸 𝒘𝒘 • At the minimum of 𝐸𝐸 𝒘𝒘 , the gradient is 0

• And 𝒘𝒘 stays constant because 𝒘𝒘 𝑛𝑛 + 1 = 𝒘𝒘 𝑛𝑛 − 0

Page 26: CSE 5526: Introduction to Neural Networksmr-pc.org/t/cse5526/pdf/04b-review.pdf · 2020-05-06 · CSE 5526: Review 2 Real neurons have three main parts • Cell body (~50µm) •

26 CSE 5526: Review

The gradient is the slope and direction of steepest ascent of the error function

w

E(w)

w*

Emin

w0

Δw

wwwEwwE

wE

w ∆∆−−∆+

=

→∆ 2)()(lim

)(

000

0

Gradient

Page 27: CSE 5526: Introduction to Neural Networksmr-pc.org/t/cse5526/pdf/04b-review.pdf · 2020-05-06 · CSE 5526: Review 2 Real neurons have three main parts • Cell body (~50µm) •

27 CSE 5526: Review

Least squares classification works pretty well for double-moon, d = 1

Page 28: CSE 5526: Introduction to Neural Networksmr-pc.org/t/cse5526/pdf/04b-review.pdf · 2020-05-06 · CSE 5526: Review 2 Real neurons have three main parts • Cell body (~50µm) •

28 CSE 5526: Review

Least squares classification works less well for double-moon, d = -4

Page 29: CSE 5526: Introduction to Neural Networksmr-pc.org/t/cse5526/pdf/04b-review.pdf · 2020-05-06 · CSE 5526: Review 2 Real neurons have three main parts • Cell body (~50µm) •

29 CSE 5526: Review

LMS algorithm solves least squares on-line

• Stochastic gradient descent solution to linear regression is called the LMS algorithm

• Minimizes the error on one data point at a time 2𝐸𝐸𝑝𝑝 𝑤𝑤 = 𝑒𝑒𝑝𝑝2 𝒘𝒘 = 𝑑𝑑𝑝𝑝 − 𝑦𝑦𝑝𝑝

2 = 𝑑𝑑𝑝𝑝 − 𝒘𝒘𝑇𝑇𝒙𝒙𝑝𝑝2

• The gradient is 𝛻𝛻𝒘𝒘𝐸𝐸𝑝𝑝 𝒘𝒘 = − 𝑑𝑑𝑝𝑝 − 𝒘𝒘𝑇𝑇𝒙𝒙𝑝𝑝 𝒙𝒙𝑝𝑝 = −𝑒𝑒𝑝𝑝 𝒘𝒘 𝒙𝒙𝑝𝑝

• So the LMS update is 𝒘𝒘 𝑛𝑛 + 1 = 𝒘𝒘 𝑛𝑛 − 𝜂𝜂𝛻𝛻𝒘𝒘𝐸𝐸𝑝𝑝 𝒘𝒘

= 𝒘𝒘 𝑛𝑛 + 𝜂𝜂𝑒𝑒𝑝𝑝 𝒘𝒘 𝒙𝒙𝑝𝑝

Page 30: CSE 5526: Introduction to Neural Networksmr-pc.org/t/cse5526/pdf/04b-review.pdf · 2020-05-06 · CSE 5526: Review 2 Real neurons have three main parts • Cell body (~50µm) •

30 CSE 5526: Review

LMS achieves the least squares solution for double-moon, d = 1

Page 31: CSE 5526: Introduction to Neural Networksmr-pc.org/t/cse5526/pdf/04b-review.pdf · 2020-05-06 · CSE 5526: Review 2 Real neurons have three main parts • Cell body (~50µm) •

31 CSE 5526: Review

LMS achieves the least squares solution for double-moon, d=-4

Page 32: CSE 5526: Introduction to Neural Networksmr-pc.org/t/cse5526/pdf/04b-review.pdf · 2020-05-06 · CSE 5526: Review 2 Real neurons have three main parts • Cell body (~50µm) •

32 CSE 5526: Review

The optimal learning rate for a parabola is the reciprocal of the second derivative

w

E(w)

w* w0

𝜂𝜂 < 𝐸𝐸′′ 𝑤𝑤 −1

w

E(w)

w* w0

𝜂𝜂 = 𝐸𝐸′′ 𝑤𝑤 −1

w

E(w)

w* w0

𝜂𝜂 > 2 𝐸𝐸′′ 𝑤𝑤 −1

w

E(w)

w* w0

𝜂𝜂 > 𝐸𝐸′′ 𝑤𝑤 −1

Page 33: CSE 5526: Introduction to Neural Networksmr-pc.org/t/cse5526/pdf/04b-review.pdf · 2020-05-06 · CSE 5526: Review 2 Real neurons have three main parts • Cell body (~50µm) •

33 CSE 5526: Review

Multilayer perceptrons aren’t really perceptrons

Page 34: CSE 5526: Introduction to Neural Networksmr-pc.org/t/cse5526/pdf/04b-review.pdf · 2020-05-06 · CSE 5526: Review 2 Real neurons have three main parts • Cell body (~50µm) •

34 CSE 5526: Review

MLPs can be trained to minimize the MSE

• Think of an MLP as a complicated, non-linear function of its input parametrized by 𝒘𝒘:

𝐲𝐲 = 𝐹𝐹 𝒙𝒙;𝒘𝒘 • Given a set of training data 𝒙𝒙𝑝𝑝,𝒅𝒅𝑝𝑝 , adjust 𝒘𝒘 to

minimize the mean square error of its predictions

𝐸𝐸� 𝒘𝒘 = �𝐸𝐸𝑝𝑝 𝒘𝒘𝑝𝑝

= �12

𝒅𝒅𝑝𝑝 − 𝐹𝐹 𝒙𝒙𝑝𝑝;𝒘𝒘2

𝑝𝑝

Page 35: CSE 5526: Introduction to Neural Networksmr-pc.org/t/cse5526/pdf/04b-review.pdf · 2020-05-06 · CSE 5526: Review 2 Real neurons have three main parts • Cell body (~50µm) •

35 CSE 5526: Review

Gradient descent in MLPs is called backprop

• Error assigned to each neuron 𝑒𝑒𝑘𝑘 = 𝑑𝑑𝑘𝑘 − 𝑦𝑦𝑘𝑘

𝑒𝑒𝑗𝑗 = �𝑒𝑒𝑘𝑘𝜑𝜑𝜑(𝑣𝑣𝑘𝑘)𝑤𝑤𝑘𝑘𝑗𝑗𝑘𝑘

• Gradients computed for each weight 𝜕𝜕

𝜕𝜕𝑤𝑤𝑘𝑘𝑗𝑗𝐸𝐸 𝒘𝒘 = −𝑒𝑒𝑘𝑘𝜑𝜑′ 𝑣𝑣𝑘𝑘 𝑦𝑦𝑗𝑗

𝜕𝜕𝜕𝜕𝑤𝑤𝑗𝑗𝑖𝑖

𝐸𝐸 𝒘𝒘 = −𝑒𝑒𝑗𝑗𝜑𝜑′ 𝑣𝑣𝑗𝑗 𝑥𝑥𝑖𝑖

𝜑𝜑𝑘𝑘 yj 𝜑𝜑𝑗𝑗 xi

wji wkj yk vj vk E

Page 36: CSE 5526: Introduction to Neural Networksmr-pc.org/t/cse5526/pdf/04b-review.pdf · 2020-05-06 · CSE 5526: Review 2 Real neurons have three main parts • Cell body (~50µm) •

36 CSE 5526: Review

Gradient descent in MLPs is called backprop

• So the weights are updated as 𝑤𝑤𝑘𝑘𝑗𝑗 𝑛𝑛 + 1 = 𝑤𝑤𝑘𝑘𝑗𝑗 𝑛𝑛 + 𝜂𝜂𝑒𝑒𝑘𝑘𝜑𝜑′ 𝑣𝑣𝑘𝑘 𝑦𝑦𝑗𝑗 𝑤𝑤𝑗𝑗𝑖𝑖 𝑛𝑛 + 1 = 𝑤𝑤𝑗𝑗𝑖𝑖 𝑛𝑛 + 𝜂𝜂𝑒𝑒𝑗𝑗𝜑𝜑′ 𝑣𝑣𝑗𝑗 𝑥𝑥𝑖𝑖

• Easy to extend to more layers • Although the gradient itself is less well behaved • So second-order methods are more necessary

𝜑𝜑𝑘𝑘 yj 𝜑𝜑𝑗𝑗 xi

wji wkj yk vj vk E

Page 37: CSE 5526: Introduction to Neural Networksmr-pc.org/t/cse5526/pdf/04b-review.pdf · 2020-05-06 · CSE 5526: Review 2 Real neurons have three main parts • Cell body (~50µm) •

37 CSE 5526: Review

Backprop can be visualized as a flow chart

Page 38: CSE 5526: Introduction to Neural Networksmr-pc.org/t/cse5526/pdf/04b-review.pdf · 2020-05-06 · CSE 5526: Review 2 Real neurons have three main parts • Cell body (~50µm) •

38 CSE 5526: Review

Must set several parameters to build an MLP

• Model parameters • Number of hidden layers • Number of units in each hidden layer • Activation function • Error function

• It is best to compare different settings empirically

Page 39: CSE 5526: Introduction to Neural Networksmr-pc.org/t/cse5526/pdf/04b-review.pdf · 2020-05-06 · CSE 5526: Review 2 Real neurons have three main parts • Cell body (~50µm) •

39 CSE 5526: Review

There are many optimization tricks for finding better local minima in backprop

• Momentum: mix in gradient from step 𝑛𝑛 − 1 • Weight initialization: small random values • Stopping criterion: early stopping • Learning rate annealing: start large, slowly shrink • Second order methods: use a separate 𝜂𝜂 for each

pair of parameters based on local curvature • Randomize training example order • Regularization: terms in E(w) that only depend on w

Page 40: CSE 5526: Introduction to Neural Networksmr-pc.org/t/cse5526/pdf/04b-review.pdf · 2020-05-06 · CSE 5526: Review 2 Real neurons have three main parts • Cell body (~50µm) •

40 CSE 5526: Review

MLP learns double-moon, d = -4

Page 41: CSE 5526: Introduction to Neural Networksmr-pc.org/t/cse5526/pdf/04b-review.pdf · 2020-05-06 · CSE 5526: Review 2 Real neurons have three main parts • Cell body (~50µm) •

41 CSE 5526: Review

MLP learns double-moon, d = -5

Page 42: CSE 5526: Introduction to Neural Networksmr-pc.org/t/cse5526/pdf/04b-review.pdf · 2020-05-06 · CSE 5526: Review 2 Real neurons have three main parts • Cell body (~50µm) •

42 CSE 5526: Review

Our goal is to train models that generalize

• Models must be complex enough to capture important variations in the training data

• But not so complex that they capture the random variations in the training data

• We evaluate generalization by measuring performance on a held-out test or validation set

Page 43: CSE 5526: Introduction to Neural Networksmr-pc.org/t/cse5526/pdf/04b-review.pdf · 2020-05-06 · CSE 5526: Review 2 Real neurons have three main parts • Cell body (~50µm) •

43 CSE 5526: Review

Polynomial of order 0 cannot capture important variations

Page 44: CSE 5526: Introduction to Neural Networksmr-pc.org/t/cse5526/pdf/04b-review.pdf · 2020-05-06 · CSE 5526: Review 2 Real neurons have three main parts • Cell body (~50µm) •

44 CSE 5526: Review

Polynomial of order 1 cannot capture important variations

Page 45: CSE 5526: Introduction to Neural Networksmr-pc.org/t/cse5526/pdf/04b-review.pdf · 2020-05-06 · CSE 5526: Review 2 Real neurons have three main parts • Cell body (~50µm) •

45 CSE 5526: Review

Polynomial of order 3 can capture important variations

Page 46: CSE 5526: Introduction to Neural Networksmr-pc.org/t/cse5526/pdf/04b-review.pdf · 2020-05-06 · CSE 5526: Review 2 Real neurons have three main parts • Cell body (~50µm) •

46 CSE 5526: Review

Polynomial of order 9 captures unimportant variations

Page 47: CSE 5526: Introduction to Neural Networksmr-pc.org/t/cse5526/pdf/04b-review.pdf · 2020-05-06 · CSE 5526: Review 2 Real neurons have three main parts • Cell body (~50µm) •

47 CSE 5526: Review

Learning curves can tell you whether a model is too complex or too simple

Page 48: CSE 5526: Introduction to Neural Networksmr-pc.org/t/cse5526/pdf/04b-review.pdf · 2020-05-06 · CSE 5526: Review 2 Real neurons have three main parts • Cell body (~50µm) •

48 CSE 5526: Review

Under-fit Good fit Over-fit Training error High Low Low Testing error High Low High

Simple models under-fit complex models over-fit

Page 49: CSE 5526: Introduction to Neural Networksmr-pc.org/t/cse5526/pdf/04b-review.pdf · 2020-05-06 · CSE 5526: Review 2 Real neurons have three main parts • Cell body (~50µm) •

49 CSE 5526: Review

Fit is relative to the amount of training data

• Polynomial of order 9 fit to 10 points

Page 50: CSE 5526: Introduction to Neural Networksmr-pc.org/t/cse5526/pdf/04b-review.pdf · 2020-05-06 · CSE 5526: Review 2 Real neurons have three main parts • Cell body (~50µm) •

50 CSE 5526: Review

Fit is relative to the amount of training data

• Polynomial of order 9 fit to 15 points

Page 51: CSE 5526: Introduction to Neural Networksmr-pc.org/t/cse5526/pdf/04b-review.pdf · 2020-05-06 · CSE 5526: Review 2 Real neurons have three main parts • Cell body (~50µm) •

51 CSE 5526: Review

Fit is relative to the amount of training data

• Polynomial of order 9 fit to 100 points

Page 52: CSE 5526: Introduction to Neural Networksmr-pc.org/t/cse5526/pdf/04b-review.pdf · 2020-05-06 · CSE 5526: Review 2 Real neurons have three main parts • Cell body (~50µm) •

52 CSE 5526: Review

Simple networks are dominated by bias complex networks are dominated by variance

Page 53: CSE 5526: Introduction to Neural Networksmr-pc.org/t/cse5526/pdf/04b-review.pdf · 2020-05-06 · CSE 5526: Review 2 Real neurons have three main parts • Cell body (~50µm) •

53 CSE 5526: Review

Function approximation

• Think of the MSE as a measure of goodness of fit for function approximation

• We have discussed several function approximators

Model 𝒚𝒚𝒑𝒑 = 𝒇𝒇(𝒙𝒙𝒑𝒑)

M-P Neuron 𝑦𝑦 = signum 𝒘𝒘𝑇𝑇𝒙𝒙 Linear regression 𝑦𝑦 = 𝒘𝒘𝑇𝑇𝒙𝒙

MLP

𝑦𝑦𝑘𝑘 = 𝜑𝜑 �𝑤𝑤𝑘𝑘𝑗𝑗𝑗𝑗

𝜑𝜑 �𝑤𝑤𝑗𝑗𝑖𝑖𝑥𝑥𝑖𝑖𝑖𝑖 𝑗𝑗 𝑘𝑘

RBF network 𝑦𝑦 = �𝑤𝑤𝑘𝑘𝜑𝜑𝑘𝑘

𝒙𝒙 − 𝝁𝝁𝑘𝑘

Page 54: CSE 5526: Introduction to Neural Networksmr-pc.org/t/cse5526/pdf/04b-review.pdf · 2020-05-06 · CSE 5526: Review 2 Real neurons have three main parts • Cell body (~50µm) •

54 CSE 5526: Review

Linear projection computes weights for bases

• It is possible to approximate a function 𝑓𝑓(𝒙𝒙) by a linear combination of simpler functions

𝐹𝐹 𝒙𝒙 = �𝑤𝑤𝑗𝑗𝜑𝜑𝑗𝑗(𝒙𝒙)𝑗𝑗

• If wj’s can be chosen so that approximation error is arbitrarily small for any function 𝑓𝑓(𝒙𝒙) over the domain of interest, then {𝜑𝜑𝑗𝑗} has the property of universal approximation, or {𝜑𝜑𝑗𝑗} is complete

Page 55: CSE 5526: Introduction to Neural Networksmr-pc.org/t/cse5526/pdf/04b-review.pdf · 2020-05-06 · CSE 5526: Review 2 Real neurons have three main parts • Cell body (~50µm) •

55 CSE 5526: Review

Radial basis function networks are similar to MLPs in structure

Page 56: CSE 5526: Introduction to Neural Networksmr-pc.org/t/cse5526/pdf/04b-review.pdf · 2020-05-06 · CSE 5526: Review 2 Real neurons have three main parts • Cell body (~50µm) •

56 CSE 5526: Review

RBF nets are trained in three steps

• To train 1. Choose the Gaussian centers using K-means, etc. 2. Determine the Gaussian widths as the variance of each

cluster, or using 𝑑𝑑max 3. Determine the weights 𝑤𝑤𝑗𝑗 using linear regression

• Select the number of bases using (cross-)validation

Page 57: CSE 5526: Introduction to Neural Networksmr-pc.org/t/cse5526/pdf/04b-review.pdf · 2020-05-06 · CSE 5526: Review 2 Real neurons have three main parts • Cell body (~50µm) •

57 CSE 5526: Review

RBF learns double-moon, d = -5

Page 58: CSE 5526: Introduction to Neural Networksmr-pc.org/t/cse5526/pdf/04b-review.pdf · 2020-05-06 · CSE 5526: Review 2 Real neurons have three main parts • Cell body (~50µm) •

58 CSE 5526: Review

RBF net learns double-moon, d = -6