Shailrshah

Delta Learning Rule

Jan 13th, 2016
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scilab 0.58 KB | None | 0 0
  1. //delta.sce
  2. x = [1 -2 0 -1; 0 1.5 -0.5 -1; -1 1 0.5 -1]'
  3. w = [1 -1 0 0.5]'
  4. k = 0.1
  5. d = [-1 -1 1]
  6. [r c] = size(x)
  7. while(1)
  8.     e = 0
  9.     for i=1:c
  10.         net = w'*x(: , i)
  11.         o = 2/(1+exp(-net))-1 //lambda=1
  12.         diffO = 0.5*(1-o^2)
  13.         r = (d(i)-o)*diffO
  14.         e = e + 0.5*(d(i)-o)^2 //square error minimization
  15.         w=w+k*r.*x(:, i)
  16.     end
  17.     if e < 0.1
  18.         break
  19.     end
  20. end
  21. save('val2.sod', 'w', 'x')
  22.  
  23. //deltarecall.sce
  24. load('val2.sod', 'w', 'x')
  25. [r c] = size(x)
  26. for i=1:c
  27.      net = w'*x(: , i)
  28.      o = 2/(1+exp(-net))-1 //lambda=1
  29. end
Add Comment
Please, Sign In to add comment