How can I change "Validation Checks" value from 6 to higher or lower values using code?
I have following code:
% Create a Pattern Recognition Network
hiddenLayerSize = ns;
net = patternnet(hiddenLayerSize);
net.divideParam.trainRatio = trRa/100;
net.divideParam.valRatio = vaRa/100;
net.divideParam.testRatio = teRa/100;
% Train the Network
[net,tr] = train(net,inputs,targets);
% Test the Network
outputs = net(inputs);
errors = gsubtract(targets,outputs);
performance = perform(net,targets,outputs);
% Recalculate Training, Validation and Test Performance
trainTargets = targets .* tr.trainMask{1};
valTargets = targets .* tr.valMask{1};
testTargets = targets .* tr.testMask{1};
trainPerformance = perform(net,trainTargets,outputs);
valPerformance = perform(net,valTargets,outputs);
testPerformance = perform(net,testTargets,outputs);
I could not find a clue at http://www.mathworks.com/help/nnet/ug/train-and-apply-multilayer-neural-networks.html
TL;DL:
net.trainParam.max_fail = 8;
I've used the example provided in the page you linked to get a working instance of
nntraintool
.When you open
nntraintool.m
you see a small piece of documentation that says (among else):This hinted that some properties are stored within
net.trainParam
. When querying it to see what it holds you get:Here you can see how the Maximum Validation Checks is stored: in a field named
max_fail
. Now it was only a case of testing if it was a read-only field or not, which could easily be tested usingnet.trainParam.max_fail = 8; train(net,...);
- which correctly changed the default value from 6 to 8.