Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Topic: Improving ANN results
Replies: 16   Last Post: Nov 13, 2013 9:10 AM

 Messages: [ Previous | Next ]
 chaudhry Posts: 26 Registered: 10/13/13
Improving ANN results
Posted: Oct 13, 2013 10:50 AM

Stack Exchange
?bilal zafar 1 chat meta about help

Stack Overflow

Questions
Tags
Users

How to improve ANN results by reducing error through hidden layer size, through MSE, or by using while loop?
up vote 0 down vote favorite

This is my source code and I want to reduce the possible errors. When running this code there is a lot of difference between trained output to target. I have tried different ways but didn't work so please help me reducing it.

a=[31 9333 2000;31 9500 1500;31 9700 2300;31 9700 2320;31 9120 2230;31 9830 2420;31 9300 2900;31 9400 2500]'
g=[35000;23000;3443;2343;1244;9483;4638;4739]'
h=[31 9333 2000]'

inputs =(a);
targets =[g];

% Create a Fitting Network
hiddenLayerSize = 1;
net = fitnet(hiddenLayerSize);

% Choose Input and Output Pre/Post-Processing Functions
% For a list of all processing functions type: help nnprocess
net.inputs{1}.processFcns = {'removeconstantrows','mapminmax'};
net.outputs{2}.processFcns = {'removeconstantrows','mapminmax'};

% Setup Division of Data for Training, Validation, Testing
% For a list of all data division functions type: help nndivide
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;

% For help on training function 'trainlm' type: help trainlm
% For a list of all training functions type: help nntrain
net.trainFcn = 'trainlm'; % Levenberg-Marquardt
% Choose a Performance Function
% For a list of all performance functions type: help nnperformance
net.performFcn = 'mse'; % Mean squared error

% Choose Plot Functions
% For a list of all plot functions type: help nnplot
net.plotFcns = {'plotperform','plottrainstate','ploterrhist', ...
'plotregression','plotconfusion' 'plotfit','plotroc'};
% Train the Network
[net,tr] = train(net,inputs,targets);
plottrainstate(tr)

% Test the Network
outputs = net(inputs)
errors = gsubtract(targets,outputs)
fprintf('errors = %4.3f\t',errors);
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);

% View the Network
view(net);
sc=sim(net,h

Date Subject Author
10/13/13 chaudhry
10/15/13 Greg Heath
10/15/13 Greg Heath
10/17/13 chaudhry
10/17/13 chaudhry
10/18/13 Greg Heath
10/17/13 chaudhry
10/17/13 chaudhry
10/23/13 chaudhry
10/23/13 chaudhry
10/23/13 chaudhry
10/25/13 Greg Heath
11/3/13 chaudhry
11/3/13 Greg Heath
11/6/13 Greg Heath
11/6/13 Greg Heath
11/13/13 chaudhry