Can a user-defined function be called after weight/bias updates during training?

Hello.
I was wondering if there's a way to specify a function to be executed after weight/bias updates when calling train() or adapt()?
My current solution is to call train multiple times with net.trainParam.epochs=1, but this appears to negatively impact learning.
Thanks
-- Jeff

2 Comments

Hi Greg. Well, I would like to track the weights as they update, and I would also like to modify some of them myself along the way. I'm currently just running train with trainParam.epochs=1 to do so, but as we've chatted about, this can shoot the learning alg in the foot.
Thanks again.

Sign in to comment.

 Accepted Answer

In a recent post originated by Jason, I've shown that interrupted training using net.trainParam.epochs = 1 without a validation set can yield the same weights as continued training. However, it may take much longer. How much longer will be different for different problems.
WB(:,i) = getwb(net);
Is sufficient for saving the weights of the ith epoch.
Hope this helps.
Thank you for formally accepting my answer.
Greg

1 Comment

hi greg, im using r2008a, i cant find the getwb function. does it only offer using newer version?

Sign in to comment.

More Answers (1)

The reason the stopping/starting negatively impacts learning is because the learning parameters are reinitialized every time train is called. Even if you obtain the final parameters from
net.trainParam: .showWindow, .showCommandLine, .show, .epochs,
.time, .goal, .min_grad, .max_fail, .mu, .mu_dec,
.mu_inc, .mu_max
and/or
tr: .mu, .gradient, .val_fail, etc
there is no way to use them to initialize the next call of train unless the function is modified.
Perhaps that will be available in a new version. (I've suggested that to the TBX author.)
Hope this helps.
Thank you for formally accepting my answer.
Greg

Categories

Find more on Deep Learning Toolbox in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!