How to fix premnmx to mapminmax
6 次查看(过去 30 天)
显示 更早的评论
Hello, I have a problem. I hava a file for NNs created with matlab 7 but I have Matlabr2011b, the point is that the NNs works but at the beginning says there is a problem because 'premnmx' is an old function and I have to use 'mapminmax' but when I change it says 'too many output arguments' and I don't know how to fix it.
Here there are the two errors:
before
Warning: PREMNMX is an obsolete function.
> In obs_fcn at 18
In premnmx at 23
In oxbr at 17
Use MAPMINMAX instead, type HELP PREMNMX for bug warning.
Warning: NEWFF used in an obsolete way.
> In obs_use at 18
In newff>create_network at 127
In newff at 102
In oxbr at 31
See help for NEWFF to update calls to the new argument list.
After
Error using mapminmax
Too many output arguments.
Error in oxbrtry (line 17)
[PN,MINP,MAXP,TN,MINT,MAXT]=mapminmax(P,T);
Instead here ther is the code for my NN if you want:
% XARXA NEURONAL Regularitzacio Bayesiana
clear all
close all
% Patterns I(E1) , I(E2), I(E3), I(E4) ... hasta I(E26)
% una mostra a cada fila
% Targets (mM) AA 4AP PCT
% les mostres corresponents a cada fila
load 'intensitats.dat'
P=intensitats';
load 'concs.dat'
T=concs';
%normalitzacio
[PN,MINP,MAXP,TN,MINT,MAXT]=premnmx(P,T);
nfiles=size(T,2);
nftrain=ceil(0.65*nfiles);
iitr=1:nftrain;
iitst=(nftrain+1):nfiles;
test.P=PN(:,iitst);
test.T=TN(:,iitst);
ptr=PN(:,iitr);
ttr=TN(:,iitr);
%br
net = newff(minmax(ptr),[3 3],{'tansig','satlins'},'trainbr');
% Funciones:logsig,tansig,purelin,satlins
%Número d'èpoques
net.trainParam.epochs=5000;
%Màxim error que volem
net.trainParam.goal=1e-3;
net.trainParam.mu=0.5;
net.trainParam.mu_dec=0.9;
%L'entrenament para si l'error de validació augmenta un nombre d'èpoques (per defecte 5)
net.trainParam.max_fail=25;
net.trainParam.min_grad=1e-10;
net.trainParam.show = 25;
net.trainParam.lr= 0.1;
net.trainParam.mc = 0.4;
net.layers{1}.initFcn = 'initwb';
net.inputWeights{1,1}.initFcn = 'rands';
net.biases{1,1}.initFcn = 'rands';
net.biases{2,1}.initFcn = 'rands';
net.adaptParam.passes = 20;
net = init(net)
[net,tr] = train(net,ptr,ttr,[],[],test);
testin=test.P;
testout=test.T;
% valors inicials i finals per training i test
ptrn=sim(net,ptr);
tr=postmnmx(ptrn,MINT,MAXT);
dttr=postmnmx(ttr,MINT,MAXT);
%valn=sim(net,valin);
%dval=postmnmx(valn,MINT,MAXT);
%dvalout=postmnmx(valout,MINT,MAXT);
tstn=sim(net,testin);
dtst=postmnmx(tstn,MINT,MAXT);
dtestout=postmnmx(testout,MINT,MAXT);
% Figures valors inicials /vs/ valors finals training, validacio, test
figure
[m2,b2,r2]=postreg(tr(1,:),dttr(1,:));
legend('trainingAA')
%figure
%[m01,b01,r01]=postreg(dvalout(1,:),dval(1,:));
%legend('validationAA')
figure
[m1,b1,r1]=postreg(dtestout(1,:),dtst(1,:));
legend('testAA')
figure
[m22,b22,r22]=postreg(tr(2,:),dttr(2,:));
legend('training4AP')
%figure
%[m02,b02,r02]=postreg(dvalout(2,:),dval(2,:));
%legend('validation4AP')
figure
[m12,b12,r12]=postreg(dtestout(2,:),dtst(2,:));
legend('test4AP')
figure
[m23,b23,r23]=postreg(tr(3,:),dttr(3,:));
legend('trainingPCT')
%figure
%[m03,b03,r03]=postreg(dvalout(3,:),dval(3,:));
%legend('validationPCT')
figure
[m13,b13,r13]=postreg(dtestout(3,:),dtst(3,:));
legend('testPCT')
%residuals del test
fct=size(iitst,2);
sumAA=0;
sumpAP=0;
sumPCT=0;
for i=1:fct;
resid1(i)=((dtestout(1,i)-dtst(1,i))^2);
resid2(i)=((dtestout(2,i)-dtst(2,i))^2);
resid3(i)=((dtestout(3,i)-dtst(3,i))^2);
sumAA=resid1(i)+sumAA;
sumpAP=resid2(i)+sumpAP;
sumPCT=resid3(i)+sumPCT;
AA=(sumAA/fct)^0.5;
pAP=(sumpAP/fct)^0.5;
PCT=(sumPCT/fct)^0.5;
end
sumtot=(AA^2+pAP^2+PCT^2)^0.5;
figure
res1=(tr(1,:)-dttr(1,:));
plot (res1,'.r-')
hold on
res2=(tr(2,:)-dttr(2,:));
plot (res2,'.k-')
hold on
res3=(tr(3,:)-dttr(3,:));
plot (res3,'.c-')
hold on
legend('Acid Ascorbic','4-Aminofenol','Paracetamol',-1);
ylabel('residuals training');xlabel('punt');
figure
res1=(dtestout(1,:)-dtst(1,:));
plot (res1,'.r-')
hold on
res2=(dtestout(2,:)-dtst(2,:));
plot (res2,'.k-')
hold on
res3=(dtestout(3,:)-dtst(3,:));
plot (res3,'.c-')
hold on
legend('Acid Ascorbic','4-Aminofenol','Paracetamol',-1);
ylabel('residuals del test-set');xlabel('punt');
%figure
%res=(dtestout(1,:)-dtst(1,:));
%plot (res,'.r-')
%hold on
%legend('Acid Ascorbic');
%ylabel('residuals del test-set');xlabel('punt');
%figure
%res2=(dtestout(2,:)-dtst(2,:));
%plot (res2,'.k-')
%hold on
%legend('4-Aminofenol');
%ylabel('residuals del test-set');xlabel('punt');
%figure
%res3=(dtestout(3,:)-dtst(3,:));
%plot (res,'.y-')
%hold on
%legend('Paracetamol');
%ylabel('residuals del test-set');xlabel('punt');
fid = fopen('TAA.txt','w');
fprintf(fid,'%6.8f\n',dtst(1,:));
fclose(fid);
fid = fopen('T4AP.txt','w');
fprintf(fid,'%6.8f\n',dtst(2,:));
fclose(fid);
fid = fopen('TPCT.txt','w');
fprintf(fid,'%6.8f\n',dtst(3,:));
fclose(fid);
AA
pAP
PCT
sumtot
result=[sumtot AA pAP PCT 0 0 0 m2 b2 r2 0 0 0 m1 b1 r1 m22 b22 r22 0 0 0 m12 b12 r12 m23 b23 r23 0 0 0 m13 b13 r13];
fid = fopen('Res.txt','w');
fprintf(fid,'%6.8f\n', result);
fclose(fid);
Thanks for the help.
0 个评论
采纳的回答
Jisha
2012-4-17
You are requesting too many (6) output arguments from the function mapminmax
[PN,MINP,MAXP,TN,MINT,MAXT]=premnmx(P,T);
simply changing the premnmx to mapinmax will not work here.. since the maximum number of output arguments from mapminmax is 2
[Y,PS] = mapminmax(X,YMIN,YMAX)
You will have to change your code quite a bit..
0 个评论
更多回答(1 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!