Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //delta.sce
- x = [1 -2 0 -1; 0 1.5 -0.5 -1; -1 1 0.5 -1]'
- w = [1 -1 0 0.5]'
- k = 0.1
- d = [-1 -1 1]
- [r c] = size(x)
- while(1)
- e = 0
- for i=1:c
- net = w'*x(: , i)
- o = 2/(1+exp(-net))-1 //lambda=1
- diffO = 0.5*(1-o^2)
- r = (d(i)-o)*diffO
- e = e + 0.5*(d(i)-o)^2 //square error minimization
- w=w+k*r.*x(:, i)
- end
- if e < 0.1
- break
- end
- end
- save('val2.sod', 'w', 'x')
- //deltarecall.sce
- load('val2.sod', 'w', 'x')
- [r c] = size(x)
- for i=1:c
- net = w'*x(: , i)
- o = 2/(1+exp(-net))-1 //lambda=1
- end
Add Comment
Please, Sign In to add comment