Advertisement
Tobiasz931

^$%@#$%#@Q%@$&*$()

Apr 15th, 2013
299
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 0.65 KB | None | 0 0
  1. http://archive.ics.uci.edu/ml/datasets/Yeast
  2.  
  3. X=[1 1; 2 2; 2 1; 1 2];
  4. Y=[1;1;0;0];
  5. net=newff([0 3; 0 3], [2 1], {'tansig' 'purelin'}, 'trainlm');
  6. net=init(net);
  7. net.trainParam.epochs=20;
  8. net.trainParam.goal=0.00001;
  9. net=train(net,X',Y');
  10. [X1 Y1]=meshgrid(0:0.1:3);
  11. Z=X1;
  12. Z(:)=sim(net,[X1(:)'; Y1(:)']);
  13. surf(X1, Y1,Z);
  14.  
  15.  
  16. X=-1:0.05:1;
  17. X2=-1:0.01:1;
  18. Y=sin(3*pi*X).^2.*sin(pi*X);
  19. Y2=sin(3*pi*X2).^2.*sin(pi*X2);
  20. net=newff([-1 1], [10 1], {'tansig' 'purelin'}, 'trainlm');
  21. net.trainParam.epochs=500;
  22. net.trainParam.show=50;
  23. net.trainParam.goal=0.0000001;
  24. net=init(net);
  25. net=train(net,X,Y);
  26. Z=sim(net, X2);
  27. plot(X2, Y2, 'r', X, Y, 'gO', X2, Z, 'b');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement