different result neural network classification

hi i have a dataset consist of 200 image , each 20 image printed with one printer (so classification is 10 class) extract 176 feature from each paper.
so for input i build a 176x200 matrix, 1 to 20th column (sample) belongs to 1th printer, 21 to 40th column belong to 2th printer and so on
i make a 10x200 target matrix , i set elements of 1-20 column form first row to "1" and other elements in first row to "0", for second row set 21-40 column to "1" and other to "0" and so on i use patternnet and plot confusion matrix but at every run, result is very Variable, 30 to 80% have any idea?

 採用された回答

Greg Heath
Greg Heath 2016 年 3 月 26 日

0 投票

Yes. The default trn/val/tst data-division and weight initializations are all random.
For reproducibility, initialize the RNG to the same state before TRAIN is called.
Over the years I have used
rng(0) and rng(4151941) (a famous birth date).
Now I tend to use
rng('default')
To search for a good design, I usually use a double loop search over number of hidden nodes and Ntrials random generator states per hidden node choice:
rng('default')
j=0
for h = Hmin:dH:Hmax
j=j+1
net = fitnet(h);
blah; blah; blah;
for i = 1: Ntrials
net = configure(net,x,t);
blah; blah; blah;
NMSE(i,j) = mse(t-y)/mean(var(t',1));
end
end
Over the years I have posted zillions of examples in BOTH the NEWSGROUP and ANSWERS.
Hope this helps.
Thank you for formally accepting my answer
Greg

2 件のコメント

milad ghanbari
milad ghanbari 2016 年 3 月 26 日
thank you Greg, that rng worked so target matrix is correct? considering i,m new to neural network , whats easiest way to calculate number of hidden layer? here is my code
inputs = input;
targets = target;
% Create a Pattern Recognition Network
hiddenLayerSize = 10;
net = patternnet(hiddenLayerSize);
% Setup Division of Data for Training, Validation, Testing
net.divideParam.trainRatio = 70/100;
net.divideParam.valRatio = 15/100;
net.divideParam.testRatio = 15/100;
% Train the Network
[net,tr] = train(net,inputs,targets);
% Test the Network
outputs = net(inputs);
errors = gsubtract(targets,outputs);
performance = perform(net,targets,outputs)
% View the Network
view(net)
% Plots
figure, plotconfusion(targets,outputs)
Greg Heath
Greg Heath 2016 年 3 月 26 日
I always use one hidden layer.
Since you have designed a classifier, you are not finished until you have determined the classification error rates for all of the classes in each of the trn/val/tst data divisions.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeDeep Learning Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by