MATLAB Neural Network Training: Crazy Validation Output
Mostrar comentarios más antiguos
In order to prevent Neural Network from overfitting, I have divided the training data into two parts: Training and Validation Set (see code below):
net.divideFcn= 'divideind'; % divide the data manually
net.divideParam.trainInd= 1:99; % training data indices
net.divideParam.valInd= 2:100; % validation data indices
net.divideParam.testInd= 1:1; % testing data indices
So, the training and validation set have 99 data values (among them 98 data values are common).
However, the MATLAB Neural Network training algorithm is showing a huge performance difference in training and validation set (see image below):

In addition, this is happening always after a very few epoch (no matter how the training and validation set data are divided).
Can anybody explain why is this happening and how to solve/fix this problem?
The complete code is given below:
% Neural Network Design
net = feedforwardnet([20 40 20]);
% hidden layer transfer function (data distributed within: -1,+1)
net.layers{1}.transferFcn = 'tansig';
net.layers{2}.transferFcn = 'tansig';
net.layers{3}.transferFcn = 'tansig';
net.layers{4}.transferFcn = 'purelin';
net.biasConnect(1) = 0; // no bias connection needed
net.biasConnect(2) = 0;
net.biasConnect(3) = 0;
net.biasConnect(4) = 0;
% network training parameters
net.trainFcn = 'trainlm';
net.performFcn = 'mse';
net.trainParam.epochs = 300;
net.trainParam.max_fail = 10;
net.trainParam.min_grad = 1e-5;
net.trainParam.mu = .001;
net.trainParam.mu_dec = 0.1;
net.trainParam.mu_inc = 10;
%training and test set data
net.divideFcn= 'divideind'; % divide the data manually
net.divideParam.trainInd= 1:99; % training data indices
net.divideParam.valInd= 2:100; % validation data indices
net.divideParam.testInd= 1:1; % testing data indices
% configure and initialize Neural Network
net = configure(net, Input, Output);
net = init(net);
view(net);
% Neural Network training
[net, tr] = train(net, Input, Output);
plotperf(tr)
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Deep Learning Toolbox en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!