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