net reusing
Show older comments
Hi, I'm creating a set of nets using a code more or less like this:
net = patternnet(10);
% net initialization
% ...
for ii=1:10
net = train(net,in,tar);
netSet{ii} = net;
end
What I see is the first training takes relatively a lot of time, while the others usually are far faster. So a question comes to my mind: could be each new training starts from the previous net? If so, is there a function to re-randomize the initial weights (without the need to allocate a new net)?
Accepted Answer
More Answers (2)
Greg Heath
on 16 Dec 2011
1 vote
Patternnet is selfinitializing. Therefore
1. Initialize the rand RNG
2. Create an outer loop over nH number of candidate values for H, the number of hidden nodes
3. Create an inner loop of Ntrials random initialization designs.
4. Bottom Line: Each of the nH*Ntrials designs begins with a different set of initial weights.
Hope this helps.
Greg
3 Comments
Luca Cavazzana
on 16 Dec 2011
Greg Heath
on 18 Dec 2011
No, weight randomization only occurs when the net is created
( e.g., net = newff(...))
Greg
Greg Heath
on 18 Dec 2011
No, weight randomization only occurs when the net is created
( e.g., net = newff(...))
Greg
Greg Heath
on 17 Feb 2014
With the current set of net creation functions ( e.g., fitnet, patternnet, feedforwardnet,...) weight initialization does not occur at net creation.
If weights have not been assigned, they will be automatically initialized by train. Otherwise, train will just use the existing weights.
Therefore, when designing multiple nets in a loop, the function configure must be used to initialize the nets at the top of the loop before train is called.
net = configure(net, x, t);
Categories
Find more on Deep Learning Toolbox in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!