Abnormal outputs in Neural Networks Blind tests (new tests after the net is trained).

3 visualizaciones (últimos 30 días)
The data divisions in my ANN model is trn 60 - val 20 - tst 20 . All of my input and target values are in between 0 - 1 (numeric values). The problem that i am facing with is >> when the network is trained, i insert new data set (five new input variables but samples number are 35) to estimate the output variable, as it was already trained with the target variable. Unfortunately the output becomes exactly same for all the 35 samples. It must not happen, there is something wrong that i might have done. Could you please light some shed on these. I am using Matlab R2012b version. Matlab codes are given as follows:
Inp_var1 = xlsread('Training data.xlsx','B2:B165241');
Inp_var2 = xlsread('Training data.xlsx','D2:D165241');
Inp_var3 = xlsread('Training data.xlsx','C2:C165241');
Inp_var4 = xlsread('Training data.xlsx','E2:E165241');
Inp_var5 = xlsread('Training data.xlsx','F2:F165241');
Tar_var1 = xlsread('Training data.xlsx','K2:K165241');
Input(1,:) = Inp_var1;
Input(2,:) = Inp_var2;
Input(3,:) = Inp_var3;
Input(4,:) = Inp_var4;
Input(5,:) = Inp_var5;
Target(1,:) = Tar_var1;
net = feedforwardnet;
net = configure(net,Input,Target);
net.layers{1}.transferFcn = 'tansig';
net.layers{1}.initFcn = 'initnw';
net.layers{2}.transferFcn = 'purelin';
net.layers{2}.initFcn = 'initnw';
net = init(net);
net.IW{1,1}
net.b{1}
net.adaptFcn = 'adaptwb';
net.inputWeights{1,1}.learnFcn = 'learnp';
net.biases{1}.learnFcn = 'learnp';
inputs = Input;
targets = Target;
hiddenLayerSize = 3; % number of hidden neurons
net = fitnet(hiddenLayerSize);
net.inputs{1}.processFcns = {'removeconstantrows','mapminmax','mapstd'};
net.outputs{2}.processFcns = {'removeconstantrows','mapminmax','mapstd'};
net.divideFcn = 'dividerand';
net.divideMode = 'sample';
net.divideParam.trainRatio = 60/100;
net.divideParam.valRatio = 20/100;
net.divideParam.testRatio = 20/100;
net.trainFcn = 'trainlm';
net.performFcn = 'mse';
net.plotFcns = {'plotperform','plottrainstate','ploterrhist', ...
'plotregression', 'plotfit'};
net.efficiency.memoryReduction = 1;
[net,tr] = train(net,inputs,targets);
outputs = net(inputs);
errors = gsubtract(targets,outputs);
performance = perform(net,targets,outputs);
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)
net.trainParam.epochs;
net.trainParam.time;
net.trainParam.goal;
net.trainParam.min_grad;
net.trainParam.mu_max;
net.trainParam.max_fail;
net.trainParam.show;
end

Respuesta aceptada

Greg Heath
Greg Heath el 24 de Feb. de 2014
Most of your code is useless. It is equivalent to
Input(1,:) = xlsread('Training data.xlsx','B2:B165241');
Input(2,:) = xlsread('Training data.xlsx','D2:D165241');
Input(3,:) = xlsread('Training data.xlsx','C2:C165241');
Input(4,:) = xlsread('Training data.xlsx','E2:E165241');
Input(5,:) = xlsread('Training data.xlsx','F2:F165241');
Target(1,:) = xlsread('Training data.xlsx','K2:K165241');
hiddenLayerSize = 3; % number of hidden neurons
net = fitnet(hiddenLayerSize);
net.inputs{1}.processFcns = {'removeconstantrows','mapminmax','mapstd'};
net.outputs{2}.processFcns = {'removeconstantrows','mapminmax','mapstd'};
net.divideParam.trainRatio = 60/100;
net.divideParam.valRatio = 20/100;
net.divideParam.testRatio = 20/100;
[net,tr] = train(net,inputs,targets);
outputs = net(inputs);
errors = gsubtract(targets,outputs);
performance = perform(net,targets,outputs);
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)
Make sure the input summary statistics (mean/covariance-matrix) for the original and new data are close enough to be assumed to be drawn from the same probability distribution.
Thank you for formally accepting my answer
Greg
  6 comentarios
mmenvo
mmenvo el 26 de Feb. de 2014
Many thanks, Greg. I have understood your clarifications on point 1,2,3 and 4.
I would be happy if you kindly suggests the following:
5. What is your recommendation on ANN data division for a very large dataset? [i.e.Original training data samples are over 165240. I also have different dataset containing samples larger than 600000]. In my case i have 5 input neurons, and 1 output neuron.
which one would you recommend (tr-val-tst)>> i) 70-15-15, ii) 60-20-20, iii) 80-10-10, iv) 70-20-10, or v) 80-20-00
Greg Heath
Greg Heath el 26 de Feb. de 2014
Editada: Greg Heath el 26 de Feb. de 2014
With N this large you do not need val and test
net.divide.Fcn = 'dividetrain'; %100/0/0
and try to minimize H, the number of hidden nodes.
Hope this helps.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Sequence and Numeric Feature Data Workflows en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by