1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
| clear all; ... ... t1 = clock; net = newff([-1 1], [15 1], {'tansig' 'purelin'}, 'traingdx', 'learngdm'); net.trainParam.epochs = 2500; net.trainParam.goal = 0.001; net.trainParam.show = 10; net.trainParam.lr = 0.05;
net = train(net, p, t); datet = etime(clock, t1); save net net;
p = -1:.1:0.9; t = [-0.832 -0.423 -0.024 0.344 1.282 3.456 4.02 3.232 2.102 1.504 ... 0.248 1.242 2.344 3.262 2.052 1.684 1.022 2.224 3.022 1.984]; t1 = clock;
net = newrb(p, t, 0.1, 0.1, 20, 5); datat = etime(clock, t1);
save net net;
hold on; plot (p, t, '*');
load net net; i = -1: 0.05: 0.9; r = sim(net, i);
plot(i, r);
clear all;
p = [0 0 0 1 1 1 -1 -1 -1; 0 1 -1 0 1 -1 0 1 -1]; tc = [1 1 2 2 1 1 1 2 1];
t = ind2vec(tc);
t1 = clock; net = newpnn(p, n, 0.7); datat = etime(clock, t);
save net net;
p = [0 0 0 1 1 -1 -1 -1; 0 1 -1 0 1 -1 0 1 -1];
load net net;
y = sim(net, net); yc = vec2ind(y);
|