1 / 46

Perceptron Learning Demonstration

Langston, Cognitive Psychology. Perceptron Learning Demonstration. Perceptron Learning. How does a perceptron acquire its knowledge? The question really is: How does a perceptron learn the appropriate weights?. Perceptron Learning. Remember our features: For output: Good_Fruit = 1

ahoekstra
Download Presentation

Perceptron Learning Demonstration

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Langston, Cognitive Psychology Perceptron Learning Demonstration

  2. Perceptron Learning • How does a perceptron acquire its knowledge? • The question really is: How does a perceptron learn the appropriate weights?

  3. Perceptron Learning • Remember our features: For output: Good_Fruit = 1 Not_Good_Fruit = 0

  4. Input Taste 0.0 Output 0.0 Seeds 0.0 If ∑ > 0.4 then fire Skin Perceptron Learning • Let’s start with no knowledge:

  5. Input Taste 0.0 Output 0.0 Seeds 0.0 If ∑ > 0.4 then fire Skin Perceptron Learning • The weights are empty:

  6. Perceptron Learning • To train the perceptron, we will show it each example and have it categorize each one. • Since it’s starting with no knowledge, it is going to make mistakes. When it makes a mistake, we are going to adjust the weights to make that mistake less likely in the future.

  7. Perceptron Learning • When we adjust the weights, we’re going to take relatively small steps to be sure we don’t over-correct and create new problems.

  8. Perceptron Learning • I’m going to learn the category “good fruit” defined as anything that is sweet. • Good fruit = 1 • Not good fruit = 0

  9. Perceptron Learning • Problem space:

  10. Perceptron Learning Show it a banana: Input 1 1 Taste 0.0 Output 0.0 1 .00 1 Seeds 0.0 If ∑ > 0.4 then fire 0 0 Skin

  11. Perceptron Learning Show it a banana: Input 1 1 Taste 0.0 Output 0.0 1 .00 1 Seeds 0.0 If ∑ > 0.4 then fire 0 0 Skin

  12. Perceptron Learning Show it a banana: Input 1 1 Taste 0.0 Output 0.0 1 .00 1 Seeds 0.0 If ∑ > 0.4 then fire 0 0 Skin

  13. Perceptron Learning Show it a banana: Input 1 1 Taste 0.0 Output Teacher 0.0 1 .00 1 0 1 Seeds 0.0 If ∑ > 0.4 then fire 0 0 Skin

  14. Perceptron Learning • In this case we have: • (1 X 0) = 0 • + (1 X 0) = 0 • + (0 X 0) = 0 • It adds up to 0.0. • Since that is less than the threshold (0.40), we responded “no.” • Is that correct? No.

  15. Perceptron Learning • Since we got it wrong, we know we need to change the weights. We’ll do that using the delta rule (delta for change). • ∆w = learning rate X (overall teacher - overall output) X node output

  16. Perceptron Learning • The three parts of that are: • Learning rate: We set that ourselves. I want it to be large enough that learning happens in a reasonable amount of time, but small enough that I don’t go too fast. I’m picking 0.25. • (overall teacher - overall output): The teacher knows the correct answer (e.g., that a banana should be a good fruit). In this case, the teacher says 1, the output is 0, so (1 - 0) = 1. • node output: That’s what came out of the node whose weight we’re adjusting. For the first node, 1.

  17. Perceptron Learning • To pull it together: • Learning rate: 0.25. • (overall teacher - overall output): 1. • node output: 1. • ∆w = 0.25 X 1 X 1 = 0.25. • Since it’s a ∆w, it’s telling us how much to change the first weight. In this case, we’re adding 0.25 to it.

  18. Perceptron Learning • Let’s think about the delta rule: • (overall teacher - overall output): • If we get the categorization right, (overall teacher - overall output) will be zero (the right answer minus itself). • In other words, if we get it right, we won’t change any of the weights. As far as we know we have a good solution, why would we change it?

  19. Perceptron Learning • Let’s think about the delta rule: • (overall teacher - overall output): • If we get the categorization wrong, (overall teacher - overall output) will either be -1 or +1. • If we said “yes” when the answer was “no,” we’re too high on the weights and we will get a (teacher - output) of -1 which will result in reducing the weights. • If we said “no” when the answer was “yes,” we’re too low on the weights and this will cause them to be increased.

  20. Perceptron Learning • Let’s think about the delta rule: • Node output: • If the node whose weight we’re adjusting sent in a 0, then it didn’t participate in making the decision. In that case, it shouldn’t be adjusted. Multiplying by zero will make that happen. • If the node whose weight we’re adjusting sent in a 1, then it did participate and we should change the weight (up or down as needed).

  21. Perceptron Learning • How do we change the weights for banana?

  22. Perceptron Learning Adjusting weight 1: .25 X (1–0) X1=0.25 Input 1 1 Taste 0.0 Output Teacher 0.0 1 1 0 1 Seeds 0.0 If ∑ > 0.4 then fire 0 0 Skin

  23. Perceptron Learning Corrected weight 1: Input 1 1 Taste 0.25 Output Teacher 0.0 1 1 0 1 Seeds 0.0 If ∑ > 0.4 then fire 0 0 Skin

  24. Perceptron Learning Adjusting weight 2: .25 X (1–0) X1=0.25 Input 1 1 Taste 0.25 Output Teacher 0.0 1 1 0 1 Seeds 0.0 If ∑ > 0.4 then fire 0 0 Skin

  25. Perceptron Learning Corrected weight 2: Input 1 1 Taste 0.25 Output Teacher 0.25 1 1 0 1 Seeds 0.0 If ∑ > 0.4 then fire 0 0 Skin

  26. Perceptron Learning Adjusting weight 3: .25 X (1–0) X0=0.00 Input 1 1 Taste 0.25 Output Teacher 0.25 1 1 0 1 Seeds 0.0 If ∑ > 0.4 then fire 0 0 Skin

  27. Perceptron Learning Corrected weight 3: Input 1 1 Taste 0.25 Output Teacher 0.25 1 1 0 1 Seeds 0.0 If ∑ > 0.4 then fire 0 0 Skin

  28. Perceptron Learning • To continue training, we show it the next example, adjust the weights… • We will keep cycling through the examples until we go all the way through one time without making any changes to the weights. At that point, the concept is learned.

  29. Perceptron Learning Show it a pear: Input 1 1 Taste 0.25 Output Teacher 0.25 0 0.25 0 0 1 Seeds 0.0 If ∑ > 0.4 then fire 1 1 Skin

  30. Perceptron Learning • How do we change the weights for pear?

  31. Perceptron Learning Adjusting weight 1: .25 X (1–0) X1=0.25 Input 1 1 Taste 0.25 Output Teacher 0.25 0 0 0 1 Seeds 0.0 If ∑ > 0.4 then fire 1 1 Skin

  32. Perceptron Learning Corrected weight 1: Input 1 1 Taste 0.50 Output Teacher 0.25 0 0 0 1 Seeds 0.0 If ∑ > 0.4 then fire 1 1 Skin

  33. Perceptron Learning Adjusting weight 2: .25 X (1–0) X0=0.00 Input 1 1 Taste 0.50 Output Teacher 0.25 0 0 0 1 Seeds 0.0 If ∑ > 0.4 then fire 1 1 Skin

  34. Perceptron Learning Corrected weight 2: Input 1 1 Taste 0.50 Output Teacher 0.25 0 0 0 1 Seeds 0.0 If ∑ > 0.4 then fire 1 1 Skin

  35. Perceptron Learning Adjusting weight 3: .25 X (1–0) X1=0.25 Input 1 1 Taste 0.50 Output Teacher 0.25 0 0 0 1 Seeds 0.0 If ∑ > 0.4 then fire 1 1 Skin

  36. Perceptron Learning Corrected weight 3: Input 1 1 Taste 0.50 Output Teacher 0.25 1 1 0 1 Seeds 025 If ∑ > 0.4 then fire 0 0 Skin

  37. Perceptron Learning Here it is with the adjusted weights: Input Taste 0.50 Output 0.25 Seeds 0.25 If ∑ > 0.4 then fire Skin

  38. Perceptron Learning Show it a lemon: Input 0 0 Taste 0.50 Output Teacher 0.25 0 0 0 0 0 Seeds 0.25 If ∑ > 0.4 then fire 0 0 Skin

  39. Perceptron Learning • How do we change the weights for lemon?

  40. Perceptron Learning Here it is with the adjusted weights: Input Taste 0.50 Output 0.25 Seeds 0.25 If ∑ > 0.4 then fire Skin

  41. Perceptron Learning Show it a strawberry: Input 1 1 Taste 0.50 Output Teacher 0.25 1 1 1 1 1 Seeds 0.25 If ∑ > 0.4 then fire 1 1 Skin

  42. Perceptron Learning • How do we change the weights for strawberry?

  43. Perceptron Learning Here it is with the adjusted weights: Input Taste 0.50 Output 0.25 Seeds 0.25 If ∑ > 0.4 then fire Skin

  44. Perceptron Learning Show it a green apple: Input 0 0 Taste 0.50 Output Teacher 0.25 0 0.25 0 0 0 Seeds 0.25 If ∑ > 0.4 then fire 1 1 Skin

  45. Perceptron Learning • If you keep going, you will see that this perceptron can correctly classify the examples that we have.

  46. End Perceptron Learning Demonstration

More Related