processing of i/p data

1 Ansicht (letzte 30 Tage)
Hoda abuzied
Hoda abuzied am 25 Aug. 2011
do i have to normazile input data before introducing them to the network????.....i've read in nn toolbox that by default network normalizes inputdata so that they would fall in range of -1& 1 before starting to process them. but when i introduced data direclty without any normalization i got different results than those when i introduced data to the network after i normalized them !!! which one gives the correct data ??? do i have to normalization data before introducing them to the network ???isnot default processing of data done by the network itself is enough???

Akzeptierte Antwort

Lucas García
Lucas García am 25 Aug. 2011
Hi Hoda,
It is generally considered a good practice to pre and post process the data before and after its handled by the network. And that is what the NN toolbox does by default.
The available methods for pre processing inputs and post processing outputs can be access in a 2-layer network by typing:
net.inputs{1}.processFcns
net.outputs{2}.processFcns
So, you won't have to do anything at all. The network will receive your inputs and normalize them using mapminmax. Then the data will be processed by the network and then the outputs will be transformed back to your original units.
An example to make the math more clear:
load cancer_dataset;
% Creating a 2-layer Feed-forward network
mlp_net = newff(cancerInputs,cancerTargets,2,{'tansig'},'trainlm');
% Training the network
[mlp_net,tr] = train(mlp_net,cancerInputs,cancerTargets);
% New input to be simulated
p = 10*rand(9,1);
% The network is using mapminmax under the hood
y0 = sim(mlp_net,p);
% Now, let's do it manually to see if we obtain the same results:
p2 = mapminmax('apply',p,mlp_net.inputs{1}.processSettings{3});
y1 = purelin(mlp_net.lw{2,1}*tansig(mlp_net.iw{1,1}*p2+mlp_net.b{1,1})+mlp_net.b{2,1});
y2 = mapminmax('reverse',y1,mlp_net.outputs{2}.processSettings{2});
>> isequal(y0,y2)
ans =
1
Again, if you are using MATLAB R2011a, feedforwardnet is more efficient than newff. Just wanted to make sure that you can run the code no matter what version you have.
  2 Kommentare
Hoda abuzied
Hoda abuzied am 26 Aug. 2011
thanks alot for your answer it was very helpful......but i dont i understand this command p = 10*rand(9,1)....what does it generate ????
thanks again Lucas .
Lucas García
Lucas García am 26 Aug. 2011
p was just to show how the network can be simulated after it has been trained.
In this case, p = 10*rand(9,1), generates a random uniform vector of size 9x1 (which is the input size of the network) between 0-10 and we use it for the simulation.
Generally, once we have trained the network, we look for new data. For example here a doctor will collect the 9 inputs from a patient (via some medical test) and simulate it in the network. This collected data is our p.
Once p has been simulated in the network we obtain a result that indicates how likely this person could develop some type of cancer, since the output of the network is between 0 and 1.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by