4-2-4.m

来自「《神经网络理论与Matlab R2007实现》(程序代码)」· M 代码 · 共 24 行

M
24
字号
P=[0.4413 0.4707 0.6953 0.8133 0.4379 0.4677 0.6981 0.8002 0.4517 0.4725 0.7006 0.8201;
0.4379 0.4677 0.6981 0.8002 0.4517 0.4725 0.7006 0.8201 0.4557 0.4790 0.7019 0.8211;
0.4517 0.4725 0.7006 0.8201 0.4557 0.4790 0.7019 0.8211 0.4601 0.4811 0.7101 0.8298;]'
T=[0.4557 0.4790 0.7019 0.8211;
0.4601 0.4811 0.7101 0.8298;
0.4612 0.4845 0.7188 0.8312]';
threshold=[0 1;0 1;0 1;0 1;0 1;0 1;0 1;0 1;0 1;0 1;0 1;0 1];
a=[11 17 23];
for i=1:3
    net=newelm(threshold,[a(i),4],{'tansig','purelin'});
    net.trainParam.epochs=1000;
    net=init(net);
    net=train(net,P,T);
    y=sim(net,p_test);
    error(i,:)=y'-t;
end
hold off;
plot(1:4,error(1,:));
hold on;
plot(1:4,error(2,:),'-.');
hold on;
plot(1:4,error(3,:),'--');
hold off;

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?