Neural network with multiple inputs and single output - How to improve the performance of neural network?
조회 수: 8 (최근 30일)
이전 댓글 표시
Hello everyone! I would like to create a neural network with 5 input nodes. In the following I have created a simple code with the help of the neural network toolbox. I have a question regarding this code.
How can i improve the performance of network as i use different training algorithm (trainlm and trainscg) with different transfer function(logsig and tansig) in hidden layer, but the best results obtained are only 0.64 MSE and 0.35 R by using trainlm and tansig.
Here is my code:
x = rinputs;
t = rtargetfourthroot;
% Choose a Training Function
% For a list of all training functions type: help nntrain
% 'trainlm' is usually fastest.
% 'trainbr' takes longer but may be better for challenging problems.
% 'trainscg' uses less memory. Suitable in low memory situations.
trainFcn = 'trainlm'; % Levenberg-Marquardt backpropagation.
% Create a Fitting Network
hiddenLayerSize = 5;
net = fitnet(hiddenLayerSize,trainFcn);
% Selection of internal transfer functions
net.layers{1}.transferFcn = 'tansig';
net.layers{2}.transferFcn = 'purelin';
% Choose Input and Output Pre/Post-Processing Functions
% For a list of all processing functions type: help nnprocess
net.input.processFcns = {'removeconstantrows','mapminmax'};
net.output.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 = 60/100;
net.divideParam.valRatio = 20/100;
net.divideParam.testRatio = 20/100;
% 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'};
% Train the Network
[net,tr] = train(net,x,t);
% Test the Network
y = net(x);
e = gsubtract(t,y);
performance = perform(net,t,y)
% Recalculate Training, Validation and Test Performance
trainTargets = t .* tr.trainMask{1};
valTargets = t .* tr.valMask{1};
testTargets = t .* tr.testMask{1};
trainPerformance = perform(net,trainTargets,y)
valPerformance = perform(net,valTargets,y)
testPerformance = perform(net,testTargets,y)
Thank you
댓글 수: 0
채택된 답변
Greg Heath
2016년 4월 8일
PLEASE DO NOT POST THE SAME NEURAL NET QUESTION IN BOTH THE NEWSGROUP AND ANSWERS
Greg
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Modeling and Prediction with NARX and Time-Delay Networks에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!