iam writing source code of my program.. in which there are 3inputs and 1 outputs kindly tell me how to reduce error
jst copy the source code and run u will find errors=gsubtracr(OUTPUTS,TARGETS)…..U CAN see differnce of around 1000 or more and less in some cases i want to reduce it to zero or max 10… i want to improve my training kindly help me
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)
Best Answer