Advertisement
Guest User

NN

a guest
Feb 12th, 2015
333
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.85 KB | None | 0 0
  1. Gradient Descent Learning Algorithm for Sigmoidal Perceptrons
  2. ----------------------------------------------------------------
  3. Algorithm
  4. Initialization: Examples {( xe, ye)}e=1N, initial weights wi set to small random values, learning rate parameter η = 0.1
  5. Repeat
  6. for each training example ( xe, ye )
  7. calculate the output: o = s( s ) = 1 / ( 1 + e-s ), where: s= Σi=0d wi xi
  8. if the Perceptron does not respond correctly compute weight corrections:
  9. Δwi = Δwi + η ( ye - oe ) s( s )( 1 - s( s )) xie
  10. update the weights with the accumulated error from all examples
  11. wi = wi + Δwi // Gradient Descent Rule
  12. until termination condition is satisfied.
  13.  
  14. Example: Suppose an example of Perceptron which accepts two inputs x1 and x2, with weights w1 = 0.5 and w2 = 0.3 and w0 = -1.
  15.  
  16. Let the following example is given: x1 = 2, x2 = 1, y = 0 The output of the Perceptron is :
  17.  
  18. o = s( -1 + 2 * 0.5 + 1 * 0.3 ) = s( 0.3 ) = 0.5744
  19. The weight updates according to the gradient descent algorithm will be:
  20.  
  21. Δw0 = ( 0 - 0.5744 ) * 0.5744 * ( 1 -0.5744 ) * 1 = - 0.1404
  22.  
  23. Δw1 = ( 0 - 0.5744 ) * 0.5744 * ( 1 -0.5744 ) * 2 = - 0.2808
  24.  
  25. Δw2 = ( 0 - 0.5744 ) * 0.5744 * ( 1 -0.5744 ) * 1 = - 0.1404
  26. Let another example is given: x1 = 1, x2 = 2, y = 1
  27.  
  28. The output of the Perceptron is :
  29.  
  30. o = s( -1 + 1 * 0.5 + 2 * 0.3 ) = s( 0.1 ) = 0.525
  31. The weight updates according to the gradient descent algorithm will be:
  32.  
  33. Δw0 = - 0.1404 + ( 1 - 0.525 ) * 0.525 * ( 1 - 0.525 ) * 1 = -0.0219
  34.  
  35. Δw1 = - 0.2808 + ( 1 - 0.525 ) * 0.525 * ( 1 - 0.525 ) * 1 = -0.1623
  36.  
  37. Δw2 = - 0.1404 + ( 1 - 0.525 ) * 0.525 * ( 1 - 0.525 ) * 2 = 0.0966
  38. If there are no more examples in the batch, the weights will be modified as follows:
  39.  
  40. w0 = - 1 + ( -0.0219 ) = -1.0219
  41.  
  42. w1 = 0.5 + ( -0.1623 ) = 0.3966
  43.  
  44. w2 = 0.3 + 0.0966 = 0.3966
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement