Show older comments
I am using program to determine ann performance to predict transfer capability of power system. I have total 500 samples out of which 400 are used for training & remaining 100 are used for testing. But while executing attached program MSE increases with iterations. % Solve an Input-Output Fitting problem with a Neural Network % Script generated by NFTOOL % Created Wed Feb 29 12:21:38 IST 2012 % % This script assumes these variables are defined: % % p_training1 - input data. % p_training1 - target data.
% inputs = p_training1; % targets = t_training1;
% Create a Fitting Network %new_testing_training; % p_t_80_20; for i=1:300 new_training; hiddenLayerSize = 9; net = fitnet(hiddenLayerSize); %net.layers{1}.transferFcn = 'logsig'; %net.layers{2}.transferFcn = 'tansig'; % 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 =80/100; net.divideParam.valRatio = 10/100; net.divideParam.testRatio = 10/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 %net.trainFcn = 'trainbr';
% 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', 'plotfit'}; % net.trainParam.mu = 1; % net.trainParam.mu_dec = 0.8; % net.trainParam.mu_inc=1.5; % net.inputWeights{1,1}.learnParam.lr = 0.5; % net.biases{1,1}.learnParam.lr = 0.5;
% Train the Network %[net,tr] = train(net,inputs,targets); [net,tr] = train(net,p_training1,t_training1); [net,tr] = train(net,p_training2,t_training2); [net,tr] = train(net,p_training3,t_training3); [net,tr] = train(net,p_training4,t_training4); new_training; end % Test the Network % outputs = net(inputs); % errors = gsubtract(targets,outputs); % performance = perform(net,targets,outputs) inputs1=p_testing; targets1=t_testing; outputs1=net(inputs1); errors=gsubtract(targets1,outputs1); performance=perform(net,targets1,outputs1) % outputs = net(p_testing); % errors = gsubtract(t_testing,outputs); % performance = perform(net,t_testing,outputs)
% Recalculate Training, Validation and Test Performance trainTargets = targets1 .* tr.trainMask{1}; valTargets = targets1 .* tr.valMask{1}; testTargets = targets1 .* tr.testMask{1}; trainPerformance = perform(net,trainTargets,outputs1) valPerformance = perform(net,valTargets,outputs1) testPerformance = perform(net,testTargets,outputs1)
% View the Network view(net)
% Plots % Uncomment these lines to enable various plots. figure, plotperform(tr) figure, plottrainstate(tr) figure, plotfit(net,inputs1,targets1) figure, plotregression(targets1,outputs1) figure, ploterrhist(errors) op=mapminmax('reverse',outputs1,TS); %plot(mse); xlswrite('Book11.xls',op,'ann15_40','a14'); MSE error increases in validation & testing domain. What canbe done?
1 Comment
Walter Roberson
on 3 Mar 2012
http://www.mathworks.com/matlabcentral/answers/13205-tutorial-how-to-format-your-question-with-markup
Accepted Answer
More Answers (0)
Categories
Find more on Pattern Recognition in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!