How to use "nprtool" for testing multiple data ?

조회 수: 5 (최근 30일)
chirag
chirag 2012년 8월 16일
답변: harjeet singh 2015년 12월 20일
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
Greg Heath
Greg Heath 2015년 12월 20일
Comment by Ashfak Shaikh about 20 hours ago
Even i also facing same problem, plz help

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

답변 (1개)

harjeet singh
harjeet singh 2015년 12월 20일
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