Normalize Inputs and Targets of neural network

16 views (last 30 days)
afef on 13 Jun 2017
Commented: afef on 15 Jun 2017
Hi, i'm trying to create neural network using nprtool , i have input matrix with 9*1012 and output matrix with 2*1012 so i normalize my data using mapminmax as you can see in the code. But my data some input take a very high value numerically compared to other input so i want to know can the mapminmax can solve this problem or i should do something else to solve this because i still have a bad accuracy ?
rng('default');
x = patientInputs;
t = patientTargets ;
inputs=mapminmax(x);
targets=t;
size(inputs);
trainFcn = 'trainscg'; % Scaled conjugate gradient backpropagation.
% Create a Pattern Recognition Network
hiddenLayerSize =10;
net = patternnet(hiddenLayerSize);
net.inputs{1}.processFcns = {'removeconstantrows','mapminmax'};
net.outputs{2}.processFcns = {'removeconstantrows','mapminmax'};
net.divideFcn = 'dividerand'; % Divide data randomly
net.divideMode = 'sample'; % Divide up every sample
net.divideParam.trainRatio = 70/100;
net.divideParam.valRatio = 15/100;
net.divideParam.testRatio = 15/100;
net.performFcn = 'mse'; % Cross-Entropy
% Choose Plot Functions
% For a list of all plot functions type: help nnplot
net.plotFcns = {'plotperform','plottrainstate','ploterrhist', ...
'plotconfusion', 'plotroc'};
net.trainParam.max_fail =55;
net.trainParam.show=10;
net.trainParam.lr=0.01;
net.trainParam.epochs=90;
net.trainParam.goal=0.001;
% Train the Network
[net,tr] = train(net,inputs,targets);
y = net(inputs);
e = gsubtract(targets,y);
performance = perform(net,targets,y)
tind = vec2ind(targets);
yind = vec2ind(y);
percentErrors = sum(tind ~= yind)/numel(tind);
% Recalculate Training, Validation and Test Performance
trainPerformance = perform(net,trainTargets,y)
valPerformance = perform(net,valTargets,y)
testPerformance = perform(net,testTargets,y)
% View the Network
view(net)

Greg Heath on 15 Jun 2017
MAPMINMAX can be inappropriate only if there are outliers.
Use MAPSTD to detect outliers that can be removed or modified.
Hope this helps.
Thank you for formally accepting my answer
Greg
afef on 15 Jun 2017
Thanks i will try it

Community Treasure Hunt

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

Start Hunting!

Translated by