MATLAB Answers

Does train function return neural network with the weights of last epoch or the weights of the model with the smallest loss of all epochs?

2 views (last 30 days)
AntonyH on 25 Sep 2020
Commented: AntonyH on 4 Oct 2020
I use the training function "traingd" to train a shallow neural network by using:
[trainedNet,tr] = train(net,X,T)
When the training is done, to which epoch/iteration of the training does the neural network, which is returned as trainedNet by the "train" function, correspond?
Is it the network with the weights of the last epoch of the training before stopping or is it the network with the smallest training error which occured at a certain epoch during the training?
Thanks in advance!
I use MATLAB 2013 and MATLAB 2015 with the neural network toolbox.


Sign in to comment.

Accepted Answer

Srivardhan Gadila
Srivardhan Gadila on 30 Sep 2020
According to it "When the validation error increases for a specified number of iterations (net.trainParam.max_fail), the training is stopped, and the weights and biases at the minimum of the validation error are returned."
For more information on the "net.trainParam.max_fail" parameter, enter the following in command window:
help nnparam.max_fail

More Answers (0)

Community Treasure Hunt

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

Start Hunting!