Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- clear all
- format compact
- nntwarn off
- P=-1:0.1:-0.5;
- T=[-0.9602 -0.5770 0.0729 0.3771 0.6405 0.66];
- [R, Q] = size(P);
- [S1,Q]=size(T);
- [W1,B1]=nwtan(S1,R);
- disp_freq=100;
- max_epoch=20000;
- err_goal=0.01;
- lr=0.1;
- A1=tansig(W1*P,B1);
- E=T-A1;
- SSE=sumsqr(E);
- error=[];
- for epoch=1:max_epoch
- if SSE<err_goal, epoch=epoch-1;
- break
- end;
- D1=deltatan(A1,E);
- [dW1, dB1]=learnbp(P, D1, lr);
- W1=W1+dW1;
- B1=B1+dB1;
- A1=tansig(W1*P,B1);
- E=T-A1;
- SSE=sumsqr(E);
- error=[error SSE];
- if(rem(epoch,disp_freq)==0)
- epoch
- SSE
- plot(P,T,'r',P,A1,'g')
- pause(1e-120)
- end
- end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement