p=[0.215703 0.184468 0.669382 0.071882;
0.508849 0.613202 0.010964 0.005636;
0.018413 0.312329 0.015825 1.000000;
0.198495 0.168350 0.012520 0.002022;
0.241937 0 0.790496 0.0718815;
0.10794 0.276951 0.003350 0.022384;
0.3269415 0.1682795 0.834838 0.2510915;
0.5 0.625 0.811576 0.17779]
F=[50.40044478 198.3434254 219.2033856 65.36585321 170.7157683 64.71545211 130.3209169 144.0268874
];
t=F % 此时保证p为一行一个样本,t表示的结果为一行数据
[m,n]=size(p);
yy_temp = p;
for i=1:n
p=yy_temp;
pX=p(:,i);
pa=pX*1.1;
p(:,i)=pa;
aa=['p_increase' int2str(i) '=p'];
eval(aa);
end
for i=1:n
p=yy_temp;
pX=p(:,i);
pa=pX*0.9;
p(:,i)=pa;
aa=['p_decrease' int2str(i) '=p'];
eval(aa);
end
nntwarn off;
p=p';
net = newff(minmax(p),[8 1],{'tansig', 'purelin'}, 'traingdm');
net=init(net);
net.trainParam.show = 50;
net.trainParam.lr = 0.05;
net.trainParam.mc = 0.9;
net.trainParam.epochs = 2000;
net = train(net,p,t);
for i=1:n
eval(['p_increase', num2str(i), '=transpose(p_increase', num2str(i), ')'])
end
for i=1:n
eval(['p_decrease', num2str(i), '=transpose(p_decrease', num2str(i), ')'])
end
for i=1:n
eval(['result_in',num2str(i),'=sim(net,','p_increase',num2str(i),')'])
end
for i=1:n
eval(['result_de',num2str(i),'=sim(net,','p_decrease',num2str(i),')'])
end
for i=1:n
eval(['result_in',num2str(i),'=transpose(result_in',num2str(i),')'])
end
for i=1:n
eval(['result_de',num2str(i),'=transpose(result_de',num2str(i),')'])
end
for i=1:n
IV=['result_in',num2str(i),'-result_de',num2str(i)];
eval(['MIV_',num2str(i),'=mean(',IV,')'])
end
结果输出的MIV即为输入指标对结果的影响大小,如果输出MIV全零,注意将p归一化。
具体见[MATLAB神经网络30个案例分析].史峰.扫描版[www.xuexi111.com].pdf中第20个案例。