'apply' 'reverse' in mapminmax

12 Ansichten (letzte 30 Tage)
nguyen tien
nguyen tien am 25 Mär. 2016
Bearbeitet: KAE am 9 Okt. 2018
hi everyone, what are 'apply' and 'reverse' in mapminmax function in neuron network? if i dont use them in mapminmax, why result in ouputs neuron network is different.
p = [0, 1, 2, 3, 4, 5, 6, 7, 8];
t = [0, 0.84, 0.91, 0.14, -0.77, -0.96, -0.28, 0.66, 0.99];
nneuron = 5;
net = feedforwardnet(nneuron);
net.inputs{1}.processFcns{2} = 'mapminmax';
net.outputs{2}.processFcns{2} = 'mapminmax';
net = configure(net, p, t);
net.trainParam.epochs = 50;
net.trainParam.goal = 0.01;
net = train(net, p, t);
y1 = sim(net, p)
pn = mapminmax('apply', p, net.inputs{1}.processSettings{2});
y2n = mySigmoidalNetwork(pn, net, nneuron);
y2 = mapminmax('reverse', y2n, net.outputs{2}.processSettings{2})
function out = mySigmoidalNetwork(in, net, nneuron) Nin = length(in);
IW = net.IW{1,1};
B1 = net.b{1};
b1 = B1(1);
LW = net.LW{2,1};
b2 = net.b{2};
h = tansig(IW*in+B1*ones(1,Nin));
out = LW*h + b2;

Antworten (1)

KAE
KAE am 9 Okt. 2018
Bearbeitet: KAE am 9 Okt. 2018
mapminmax is a scaling that is applied to your input data to make it in the [-1,1] range, which you want to do. Then 'reverse' can undo the scaling, which is actually done automatically if you use your net to estimate results. If you don't apply the scaling on the inputs (which you should have a good reason not to do), you will get different results. There is a lot of information on scaling here .

Community Treasure Hunt

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

Start Hunting!

Translated by