Applied Artificial Intelligenceappliedai.wordpress.ncsu.edu/files/2018/10/session-17.pdf · Applied...

16
Applied Artificial Intelligence Session 17: Last Notes on Feedforward Networks & Moving to Convolutional Neural Network Fall 2018 NC State University Instructor: Dr. Behnam Kia Course Website: https://appliedai.wordpress.ncsu.edu/ 1 Oct 25, 2018

Transcript of Applied Artificial Intelligenceappliedai.wordpress.ncsu.edu/files/2018/10/session-17.pdf · Applied...

Page 1: Applied Artificial Intelligenceappliedai.wordpress.ncsu.edu/files/2018/10/session-17.pdf · Applied Artificial Intelligence Session 17: Last Notes on Feedforward Networks Moving to

Applied Artificial Intelligence

Session 17: Last Notes on Feedforward Networks&

Moving to Convolutional Neural NetworkFall 2018

NC State UniversityInstructor: Dr. Behnam Kia

Course Website: https://appliedai.wordpress.ncsu.edu/

1Oct 25, 2018

Page 2: Applied Artificial Intelligenceappliedai.wordpress.ncsu.edu/files/2018/10/session-17.pdf · Applied Artificial Intelligence Session 17: Last Notes on Feedforward Networks Moving to

Training Error

2

!"#$% = !'())#"% − α∇-.(!)

J(W)

w1w2

1.(!)123

= 156

78937 (897 .! − ;7 )

∇-. ! = <=>9

?. (>9 .! − ;)

Page 3: Applied Artificial Intelligenceappliedai.wordpress.ncsu.edu/files/2018/10/session-17.pdf · Applied Artificial Intelligence Session 17: Last Notes on Feedforward Networks Moving to

(Statistical) Generalization• The main challenge in machine learning is to make sure

our algorithm perform well on new, previously unseen inputs—not just those on which our model was trained.

• The ability to perform well on previously unobserved inputs is called Generalization.

• What separates machine learning from optimization is that we want the generalization error (AKA test error) to be low as well. The generalization error is defined as the expected value of the error on a new, unseen input.

3

Page 4: Applied Artificial Intelligenceappliedai.wordpress.ncsu.edu/files/2018/10/session-17.pdf · Applied Artificial Intelligence Session 17: Last Notes on Feedforward Networks Moving to

How can we affect performance on the test set when we can observe only the training set?

4

Page 5: Applied Artificial Intelligenceappliedai.wordpress.ncsu.edu/files/2018/10/session-17.pdf · Applied Artificial Intelligence Session 17: Last Notes on Feedforward Networks Moving to

How can we affect performance on the test set when we can observe only the training set?

• Trivial (but extremely important) step:– Make sure training set has the same distribution as

the test set.

5

Page 6: Applied Artificial Intelligenceappliedai.wordpress.ncsu.edu/files/2018/10/session-17.pdf · Applied Artificial Intelligence Session 17: Last Notes on Feedforward Networks Moving to

How can we affect performance on the test set when we can observe only the training set?

• Trivial (but extremely important) step:– Make sure training set has the same distribution as

the test set. i.i.d assumption in statistical learning:We typically make a set of assumptions known collectively as thei.i.d. assumptions . These assumptions are that the examples ineach dataset are independent from each other, and that the trainingset and test set are identically distributed, drawn from the sameprobability distribution as each other. The same distribution is thenused to generate every train example and every test example. Wecall that shared underlying distribution the data-generatingdistribution.

6

Page 7: Applied Artificial Intelligenceappliedai.wordpress.ncsu.edu/files/2018/10/session-17.pdf · Applied Artificial Intelligence Session 17: Last Notes on Feedforward Networks Moving to

How can we affect performance on the test set when we can observe only the training set?

• Trivial (but extremely important) steps:– Make sure training set has the same distribution as

the test set.

You cannot train model using one type/style of data and expect it to perform well on a different type/style of data.

7

Page 8: Applied Artificial Intelligenceappliedai.wordpress.ncsu.edu/files/2018/10/session-17.pdf · Applied Artificial Intelligence Session 17: Last Notes on Feedforward Networks Moving to

• code

8

Page 9: Applied Artificial Intelligenceappliedai.wordpress.ncsu.edu/files/2018/10/session-17.pdf · Applied Artificial Intelligence Session 17: Last Notes on Feedforward Networks Moving to

How can we affect performance on the test set when we can observe only the training set?

• Trivial (but extremely important) steps:– Make sure training set has the same distribution as

the test set.

– Make sure you have enough training data that samples and represents many different possible cases.

9

Page 10: Applied Artificial Intelligenceappliedai.wordpress.ncsu.edu/files/2018/10/session-17.pdf · Applied Artificial Intelligence Session 17: Last Notes on Feedforward Networks Moving to

XOR Problem:Multilayer Neural Network Solution

Slides are from Goodfellow, et.al for “Deep Learning” Book

Page 11: Applied Artificial Intelligenceappliedai.wordpress.ncsu.edu/files/2018/10/session-17.pdf · Applied Artificial Intelligence Session 17: Last Notes on Feedforward Networks Moving to

Our Goal in Machine Learning

• 1. Make the training error small.• 2. Make the gap between training and test error small.

11

Page 12: Applied Artificial Intelligenceappliedai.wordpress.ncsu.edu/files/2018/10/session-17.pdf · Applied Artificial Intelligence Session 17: Last Notes on Feedforward Networks Moving to

Our Goal in Machine Learning

• 1. Make the training error small. Underfitting

• 2. Make the gap between training and test error small.

12

Failure to do so

Page 13: Applied Artificial Intelligenceappliedai.wordpress.ncsu.edu/files/2018/10/session-17.pdf · Applied Artificial Intelligence Session 17: Last Notes on Feedforward Networks Moving to

• code

13

Page 14: Applied Artificial Intelligenceappliedai.wordpress.ncsu.edu/files/2018/10/session-17.pdf · Applied Artificial Intelligence Session 17: Last Notes on Feedforward Networks Moving to

Our Goal in Machine Learning

• 1. Make the training error small. Underfitting

• 2. Make the gap between training and test error small.

14

Failure to do so

Failure to do so

Overfitting

Page 15: Applied Artificial Intelligenceappliedai.wordpress.ncsu.edu/files/2018/10/session-17.pdf · Applied Artificial Intelligence Session 17: Last Notes on Feedforward Networks Moving to

• code

15

Page 16: Applied Artificial Intelligenceappliedai.wordpress.ncsu.edu/files/2018/10/session-17.pdf · Applied Artificial Intelligence Session 17: Last Notes on Feedforward Networks Moving to

16