how neural network outputs are kept constant for each time running the program

I used to traingdm algorithm and whenever restart my computer all outputs are changes. Because weights are different. How can I save idealized weights ?

 채택된 답변

Greg Heath
Greg Heath 2013년 5월 30일
편집: Greg Heath 2013년 5월 30일
Random weight initialization and trn/val/tst data division are defaults.
If you wish to duplicate a design you have to reset the state of the RNG. I always use rng(0) before designing the first of multiple designs in a double-loop design
rng(0)
for h = 1:numH % Loop over number of hidden nodes
for n = 1:Ntrials % Loop over number of weight initializations
s(n,h) = rng % save the initial RNG state
net = ...
......
end
end
If the best design occurs for h= Hb, n=Nb it can be recreated via
h = Hb
n = Nb
rng(s(h,n))
net = ...
If you wish to reuse a design, save the net
net1 =net;
save net1;
Then,later
load net1
net = net1
Finally, if you just want to save the weights
wb(h,n) = getwb(net).
NOTE: THE MULTIPLE INPUT COMMANDS IN HELP GETWB AND DOC GETWB ARE ERRONEOUS
Then later you can reconstruct the net via
set(net,wb)
Hope this helps.
Thank you for formally accepting my answer
Greg

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Deep Learning Toolbox에 대해 자세히 알아보기

질문:

2013년 5월 27일

Community Treasure Hunt

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

Start Hunting!

Translated by