Combine Bayesian regularization (trainbr) training algorithm with weight regularization.
1 view (last 30 days)
Show older comments
Hi everyone.
I want to ask is it okay to train a neural network using trainbr algorithm combine with network regularization in matlab? I try to use this idea, and the result is my training always stop due to reach mu_max. If I used trainbr only the train will stop due to max epoch or max validation fail.
Here is the code that I used:
TOL=0;
net = network;
net.numInputs = 1;
net.numLayers = 6;
net.biasConnect = [1;1;1;1;1;1];
net.inputConnect = [1;1;0;0;0;0];
net.layerConnect = [0 0 0 0 0 0;
0 0 0 0 0 0;
1 1 0 0 0 0;
0 0 1 0 0 0;
0 0 1 0 0 0;
0 0 0 1 1 0];
net.outputConnect = [0 0 0 0 0 1];
net.targetConnect = [0 0 0 0 0 1];
net.inputs{1}.range = ones(NID,2);
net.inputs{1}.range(:,1) = -1;
net.layers{1}.size = NNIL;
net.layers{1}.transferFcn = TFIL1;
net.layers{1}.initFcn = 'initnw';
net.layers{2}.size = NNIL;
net.layers{2}.transferFcn = TFIL2;
net.layers{2}.initFcn = 'initnw';
net.layers{3}.size = NLPC;
net.layers{3}.transferFcn = TFIL3;
net.layers{3}.initFcn = 'initnw';
net.layers{4}.size = NNIL;
net.layers{4}.transferFcn = TFIL1;
net.layers{4}.initFcn = 'initnw';
net.layers{5}.size = NNIL;
net.layers{5}.transferFcn = TFIL2;
net.layers{5}.initFcn = 'initnw';
net.layers{6}.size = NID;
net.layers{6}.transferFcn = TFIL3;
net.layers{6}.initFcn = 'initnw';
net.initFcn = 'initlay';
net.performFcn = 'mse';
net.performParam.regularization = 0.000001;
net.trainFcn = 'trainbr';
net.trainParam.epochs = 2000;
net.trainParam.min_grad = 0;
net.trainParam.minstep = 0;
net.trainParam.max_fail = 200;
net=init(net);
net.trainParam.goal = TOL;
net.divideFcn = 'divideind';
net.divideParam.trainInd = TrainIdx;
net.divideParam.valInd = ValIdx;
net.divideParam.testInd = TestIdx;
[net,tr,Y,E,Pf,Af] = train(net,Data_All,Data_All);
Thank you very much for your attention.
Answers (0)
See Also
Categories
Find more on Define Shallow Neural Network Architectures 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!