I have trained a neural network in matlab using the toolbox (code below), but I no longer have a maltab license; does anyone know if the validation in this toolbox by default is only to assess the performance of the neural network, or if it is used for early-stopping (when the error starts enhancing instead of diminishing, stop training)?

I think I remember seeing something related to this when training the ANN (number of epochs after which the training was stopped by the validation), but like I said I no longer have matlab and I can't find anything about it online... Thanks in advance!

% Create a Pattern Recognition Network
hiddenLayerSize = 15;
net = patternnet(hiddenLayerSize, trainFcn);

% Choose Input and Output Pre/Post-Processing Functions
% For a list of all processing functions type: help nnprocess
net.input.processFcns = {'removeconstantrows','mapminmax'};

% Setup Division of Data for Training, Validation, Testing
% For a list of all data division functions type: help nndivision
net.divideFcn = 'dividerand';  % Divide data randomly
net.divideMode = 'sample';  % Divide up every sample
net.divideParam.trainRatio = 65/100;
net.divideParam.valRatio = 20/100;
net.divideParam.testRatio = 15/100;

% Choose a Performance Function
% For a list of all performance functions type: help nnperformance
net.performFcn = 'crossentropy';  % Cross-Entropy

% Choose Plot Functions
% For a list of all plot functions type: help nnplot
net.plotFcns = {'plotperform','plottrainstate','ploterrhist', ...
    'plotconfusion', 'plotroc'};

% Train the Network
[net,tr] = train(net,x,t);``` 

1 Answer 1


As it appears on their documentation, yes, validation set is being used for early-stopping (which is pretty typical by the way):

The training set is used to teach the network. Training continues as long as the network continues improving on the validation set.

See here, here, and here (their example pages).


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.