How to use "nprtool" for testing multiple data ?

4 visualizzazioni (ultimi 30 giorni)
chirag
chirag il 16 Ago 2012
Risposto: harjeet singh il 20 Dic 2015
dear sir,
i am using neural classification tool "nprtool". i have 500 training data and using that once the network is trained i want to test four different data sets for the same training.
i have gone through the webnire of nprtool, i could understand how to use it. but couldnt undersatnd how to test multiple data with same trained network.
i am new to neural networks. please help me for the same.
- Chirag
  1 Commento
Greg Heath
Greg Heath il 20 Dic 2015
Comment by Ashfak Shaikh about 20 hours ago
Even i also facing same problem, plz help

Accedi per commentare.

Risposte (1)

harjeet singh
harjeet singh il 20 Dic 2015
hello chirag
i used 500 samples to train nprtool with 4 features, category 1 have code [0;1] and category 2 have code [1;0];
after training i randomly take a sample having 4 features and fed to trained NN. if NN outputs are [0;1] it belongs to category 1 otherwise at [1;0] category 2.
%////////// nn training //////////////////////////////
inputs=randint(4,500,[1 10]);
outputs=randint(2,500,[0 1]);
hiddenLayerSize = 10;
net = patternnet(hiddenLayerSize);
net.divideParam.trainRatio = 70/100;
net.divideParam.valRatio = 15/100;
net.divideParam.testRatio = 15/100;
[net,tr] = trainrp(net,inputs,outputs);
%///////////////// nn testing //////////////////////////
input=[2;3;5;6];
nn_output=round(net(input));
if(nn_output==[0;1])
display('category 1');
end
if(nn_output==[1;0])
display('category 2');
end

Community Treasure Hunt

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

Start Hunting!

Translated by