MATLAB - 如何更改 "Validation Check" 计数

MATLAB - How to change "Validation Check" count

如何使用代码将 "Validation Checks" 值从 6 更改为更高或更低的值?

我有以下代码:

% 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);

我在 http://www.mathworks.com/help/nnet/ug/train-and-apply-multilayer-neural-networks.html

找不到线索

TL;DL: net.trainParam.max_fail = 8;


我已经使用您链接的页面中提供的示例来获取 nntraintool 的工作实例。

当您打开 nntraintool.m 时,您会看到一小段文档,上面写着(除其他外):

% net.<a href="matlab:doc nnproperty.net_trainParam">trainParam</a>.<a href="matlab:doc nnparam.showWindow">showWindow</a> = false;

这暗示某些属性存储在 net.trainParam 中。当查询它以查看它包含什么时,您会得到:

ans = 


    Function Parameters for 'trainlm'

    Show Training Window Feedback   showWindow: true
    Show Command Line Feedback showCommandLine: false
    Command Line Frequency                show: 25
    Maximum Epochs                      epochs: 1000
    Maximum Training Time                 time: Inf
    Performance Goal                      goal: 0
    Minimum Gradient                  min_grad: 1e-07
    Maximum Validation Checks         max_fail: 6
    Mu                                      mu: 0.001
    Mu Decrease Ratio                   mu_dec: 0.1
    Mu Increase Ratio                   mu_inc: 10
    Maximum mu                          mu_max: 10000000000

在这里您可以看到 最大验证检查 是如何存储的:在一个名为 max_fail 的字段中。现在只是测试它是否是只读字段的情况,可以使用 net.trainParam.max_fail = 8; train(net,...); 轻松测试 - 它正确地将默认值从 6 更改为 8。