What are the reasons for having different outputs after several runs?

2 ビュー (過去 30 日間)
Sanaz
Sanaz 2013 年 9 月 12 日
コメント済み: Greg Heath 2013 年 9 月 29 日
I use the same initial condition for my network, but I still get different outputs. What are the other factors that can cause this difference?

採用された回答

Greg Heath
Greg Heath 2013 年 9 月 14 日
編集済み: Greg Heath 2013 年 9 月 14 日
The short answer is that train(only if all weights are zero) or configure( anytime) assign weights depending on the state of the RNG.
If you are training in a loop over random initial weights. The best statistically unbiased choice for the best net is determined by the minimum mse of the validation set.
rng(4151941) % Initialize RNG with famous birthday
for i = 1:Ntrials
s{i} = rng; %Save the ith state of the rng (may not need a cell)
net = configure(net,x,t);
[ net tr ] = train(net,x,t);
mseval(i) = tr.best_vperf; % Best mseval over all epochs of ith run
end
[ minmseval ibest ] = min(mseval);
rng = s{ibest}; % For repeating the best design
bestnet = configure(net,x,t);
bestIW0 = bestnet.IW
bestb0 = bestnet.b
bestLW0 = bestnet.LW
[ bestnet tr ] = train(bestnet,x,t) % NO SEMICOLON TO REVEAL ALL DETAILS!!!
Hope this helps.
Thank you for formally accepting my answer
Greg

その他の回答 (1 件)

Walter Roberson
Walter Roberson 2013 年 9 月 12 日
By default, Neural Networks are initialized randomly.
  3 件のコメント
Greg Heath
Greg Heath 2013 年 9 月 29 日
編集済み: Greg Heath 2013 年 9 月 29 日
The obsolete newfit, newpr and newff initialize when the net is created.
The current fitnet, patternnet and feedforwardnet are either initialized by configure before training OR, if configure is not used, they will be automatically initialized by train.
In the latter case it is difficult to obtain those values. If you really need them, use configure then save or print the weights before calling train.

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

カテゴリ

Help Center および File ExchangeSequence and Numeric Feature Data Workflows についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by