Neural Network - inverted pre-processing functions

조회 수: 6 (최근 30일)
Emiliano Rosso
Emiliano Rosso 2015년 11월 24일
댓글: Emiliano Rosso 2015년 11월 25일
I know that using preprocessing functions have to transform the output of the neural network to their original values using:
P = inputs;
t = targets;
[pn, Mins, maxp, tn, mint, maxt] = premnmx (p, t);
net = train (net, pn, tn);
an = sim (net, pn);
postmnmx a = (an, mint, maxt);
I would like to know if using fitnet with new preprocessing functions integrated into the neural network ('mapminmax', 'processpca', 'mapstd') for the training and calculating the output of a new data set using:
newoutputs = net (newinputs);
I still have to convert and reconvert the new data or the transformation is performed automatically.
Is there any difference if I use:
new outputs = net (newinputs);
instead of:
newoutputs = sim (net, newinputs);
?
Thank you!

채택된 답변

Greg Heath
Greg Heath 2015년 11월 25일
편집: Greg Heath 2015년 11월 25일
Why are you wasting time on a question that you can answer yourself by simply running the example in
help fitnet
To better answer your problem add
max(abs(t-y))
Hope this helps.
Greg
  댓글 수: 1
Emiliano Rosso
Emiliano Rosso 2015년 11월 25일
SOLVED
clear all
clearvars -global
inputs=[1,2,4,3,5;8,3,5,4,3];
targets=[1,0,0,1,1];
pnew=[1,4,3;1,6,5];
net=fitnet(1);
net.inputs{1}.processFcns = {};
net.outputs{2}.processFcns = {};
[pn,meanp,stdp,tn,meant,stdt] = prestd(inputs,targets);
net=train(net,pn,tn);
an = sim(net,pn);
output1 = poststd(an,meant,stdt);
pnewn = trastd(pnew,meanp,stdp);
anewn = sim(net,pnewn);
output1_new = poststd(anewn,meant,stdt);
my_weights = getx(net);
save('output1');
save('output1_new');
save('my_weights');
clear all
clearvars -global
load('output1','output1');
load('output1_new','output1_new');
load('my_weights','my_weights');
inputs=[1,2,4,3,5;8,3,5,4,3];
targets=[1,0,0,1,1];
pnew=[1,4,3;1,6,5];
net=fitnet(1);
net.inputs{1}.processFcns = {};
net.outputs{2}.processFcns = {};
net.inputs{1}.processFcns = {'mapstd'};
net.outputs{2}.processFcns = {'mapstd'};
net=train(net,inputs,targets);
net = setx(net,my_weights);
output2=net(inputs);
output2_new=net(pnew);
save('output2');
save('output2_new');
clear all;
clearvars -global;
load('output1','output1');
load('output1_new','output1_new');
load('my_weights','my_weights');
load('output2','output2');
load('output2_new','output2_new');
if isequal(output1,output2)==1
disp('output1 is equal to output2');
else
disp('output1 is NOT equal to output2');
end
if isequal(output1_new,output2_new)==1
disp('output1_new is equal to output2_new');
else
disp('output1_new is NOT equal to output2_new');
end
COMMAND WINDOW:
output1 is equal to output2
output1_new is equal to output2_new
getx & setx are used to use the same training.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Sequence and Numeric Feature Data Workflows에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by