Presentation is loading. Please wait.

Presentation is loading. Please wait.

Perceptrons Gary Cottrell. Cognitive Science Summer School 2 Perceptrons: A bit of history Frank Rosenblatt studied a simple version of a neural net called.

Similar presentations


Presentation on theme: "Perceptrons Gary Cottrell. Cognitive Science Summer School 2 Perceptrons: A bit of history Frank Rosenblatt studied a simple version of a neural net called."— Presentation transcript:

1 Perceptrons Gary Cottrell

2 Cognitive Science Summer School 2 Perceptrons: A bit of history Frank Rosenblatt studied a simple version of a neural net called a perceptron: A single layer of processing Binary output Can compute simple things like (some) boolean functions (OR, AND, etc.)

3 Cognitive Science Summer School 3 Perceptrons: A bit of history Computes the weighted sum of its inputs (the net input, compares it to a threshold, and “fires” if the net is greater than or equal than the threshold. (Note in the picture it’s “>”, but we will use “>=“ to make sure you’re awake!)

4 Cognitive Science Summer School 4 The Perceptron Activation Rule This is called a linear threshold unit net input output

5 Cognitive Science Summer School 5 Quiz Assume: FALSE == 0, TRUE==1, so if X1 is false, it is 0. Can you come up with a set of weights and a threshold so that a two-input perceptron computes OR? X1X2X1 OR X2 000 011 101 111

6 Cognitive Science Summer School 6 Quiz Assume: FALSE == 0, TRUE==1 Can you come up with a set of weights and a threshold so that a two-input perceptron computes AND? X1X2X1 AND X2 000 010 100 111

7 Cognitive Science Summer School 7 Quiz Assume: FALSE == 0, TRUE==1 Can you come up with a set of weights and a threshold so that a two-input perceptron computes XOR? X1X2X1 XOR X2 000 011 101 110

8 Cognitive Science Summer School 8 Perceptrons The goal was to make a neurally-inspired machine that could categorize inputs – and learn to do this from examples

9 Learning: A bit of history Rosenblatt (1962) discovered a learning rule for perceptrons called the perceptron convergence procedure. Rosenblatt (1962) discovered a learning rule for perceptrons called the perceptron convergence procedure. Guaranteed to learn anything computable (by a two-layer perceptron) Guaranteed to learn anything computable (by a two-layer perceptron) Unfortunately, not everything was computable (Minsky & Papert, 1969) Unfortunately, not everything was computable (Minsky & Papert, 1969) Cognitive Science Summer School 9 12/14/2015

10 10 Perceptron Learning It is supervised learning: It is supervised learning: There is a set of input patterns There is a set of input patterns and a set of desired outputs (the targets or teaching signal) and a set of desired outputs (the targets or teaching signal) The network is presented with the inputs, and FOOMP, it computes the output, and the output is compared to the target. The network is presented with the inputs, and FOOMP, it computes the output, and the output is compared to the target. If they don’t match, it changes the weights and threshold so it will get closer to producing the target next time. If they don’t match, it changes the weights and threshold so it will get closer to producing the target next time. Cognitive Science Summer School

11 11 Perceptron Learning First, get a training set - let’s choose OR Four “patterns”: X1X2X1 OR X2 000 011 101 111

12 Cognitive Science Summer School 12 Perceptron Learning Made Simple Output activation rule: Output activation rule: First, compute the output of the network: First, compute the output of the network: Learning rule: Learning rule: If output is 1 and should be 0, then lower weights to active inputs and raise the threshold θ If output is 0 and should be 1, then raise weights to active inputs and lower the threshold θ (“active input” means x i = 1, not 0)

13 Cognitive Science Summer School 13 Perceptron Learning First, get a training set - let’s choose OR Four “patterns”: Now, randomly present these to the network, apply the learning rule, and continue until it doesn’t make any mistakes. X1X2X1 OR X2 000 011 101 111

14 Cognitive Science Summer School 14 STOP HERE FOR TRAINING DEMO of OR.

15 Cognitive Science Summer School 15 Characteristics of perceptron learning Supervised learning: Gave it a set of input- output examples for it to model the function (a teaching signal) Error correction learning: only corrected it when it is wrong (never praised! ;-)) Random presentation of patterns. Slow! Learning on some patterns ruins learning on others. This can explain the U-shaped learning of the past tense in English. 12/14/2015

16 Cognitive Science Summer School 16 Perceptron Learning Made Simple for Computer Science Output activation rule: First, compute the output of the network: Learning rule: If output is 1 and should be 0, then lower weights to active inputs and raise the threshold θ If output is 0 and should be 1, then raise weights to active inputs and lower the threshold θ (“active input” means x i = 1, not 0)

17 Cognitive Science Summer School 17 Perceptron Learning Made Simple for Computer Science Learning rule: If output is 1 and should be 0, then lower weights to active inputs and raise the threshold If output is 0 and should be 1, then raise weights to active inputs and lower the threshold Easy one-line program to do this: w i (t+1) = w i (t) + α(teacher – output)x i (α is the learning rate) This is known as the delta rule because learning is based on the delta (difference) between what you did and what you should have done: δ = (teacher - output)

18 Cognitive Science Summer School 18 Let’s convince ourselves these are the same… Learning rule: If output is 1 and should be 0, then lower weights to active inputs and raise the threshold w i (t+1) = w i (t) + α(teacher – output)x i w i (t+1) = w i (t) + α(0 – 1)1 (“x i is an active input” means x i = 1) = w i (t) – αlower weight What if x i is inactive? w i (t+1) = w i (t) + α(teacher – output)x i w i (t+1) = w i (t) + α(teacher – output)0 = w i (t) (no change)

19 Cognitive Science Summer School 19 Let’s convince ourselves these are the same… Learning rule: If output is 0 and should be 1, then raise weights to active inputs and lower the threshold w i (t+1) = w i (t) + α(teacher – output)x i w i (t+1) = w i (t) + α(1 – 0)1 = w i (t) + α(raise weight)

20 Cognitive Science Summer School 20 Let’s convince ourselves these are the same… What about the threshold? We just treat θ as a weight from a unit that is always a constant -1. If output is 1 and should be 0, then lower weights to active inputs and raise the threshold Learning rule: w i (t+1) = w i (t) + α(teacher – output)x i I.e.:θ(t+1) = θ(t) + α(0 – 1)(-1) θ(t+1) = θ(t) + α(–1)(-1) θ(t+1) = θ(t) + αraise θ

21 Cognitive Science Summer School 21 Let’s convince ourselves these are the same… What if we get it right??? Then teacher = output, and … Learning rule: w i (t+1) = w i (t) + α(teacher – output)x i w i (t+1) = w i (t) + α(0)x i = w i (t) (no change)

22 Cognitive Science Summer School 22 But wait! There’s more!!! Learning rule: w i (t+1) = w i (t) + α(teacher – output)x i (α is the learning rate) In fact, this learning rule works for arbitrary numeric inputs. I.e., the x i ’s don’t need to be binary – they can be real numbers, or integers (like pixel values!). So, I can train a perceptron to be a “Gary detector,” since an image is just a table of pixel values. (Illustrate on board)

23 Cognitive Science Summer School 23 But wait! There’s more!!! Learning rule: w i (t+1) = w i (t) + α(teacher – output)x i (α is the learning rate) In fact, this learning rule works for linear outputs I.e., we can use this to do linear regression! (Illustrate on board) The learning rule itself can be derived as minimizing the euclidean distance between the desired outputs (the teaching signal) and the actual outputs.

24 Cognitive Science Summer School 24 But wait! There’s more!!! A simple variant gives us logistic regression Logistic regression, if you don’t know what that is, is when you have a nominal output variable, e.g., “give this guy a loan? Or not?” This ends up being a kind of “soft” perceptron. It is more useful than a perceptron because it gives a probability of the output being true. (Do Demo, if possible)


Download ppt "Perceptrons Gary Cottrell. Cognitive Science Summer School 2 Perceptrons: A bit of history Frank Rosenblatt studied a simple version of a neural net called."

Similar presentations


Ads by Google