MATLAB: How to improve the performance of a feed-forward backpropagation neural network

neural networkperformancer-value

Hi, I am working with MATLAB R2013a to build a prediction neural network model. I have tried to use different training algorithms, activation functions and number of hidden neurons but still can't get the R more than 0.8 for training set, validation set and testing set. The R of training set for some networks can be more than 0.8 but provide low R values (around 0.4~0.5) for validation and testing set. Below are the codes. Is there any solutions to improve the performance and R value?
inputs<48×206>, targets<5×206>
inputs = inputs;
targets = targets;
hiddenLayerSize = 15;
net = fitnet(hiddenLayerSize);
net.layers{1}.transferFcn='tansig';
net.layers{2}.transferFcn='purelin';
net.inputs{1}.processFcns = {'removeconstantrows','mapminmax'};
net.outputs{2}.processFcns = {'removeconstantrows','mapminmax'};
net.divideFcn = 'dividerand';
net.divideMode = 'sample';
net.divideParam.trainRatio = 70/100;
net.divideParam.valRatio = 15/100;
net.divideParam.testRatio = 15/100;
net.trainFcn = 'traincgp';
net.performFcn = 'mse';
net.plotFcns = {'plotperform','plottrainstate','ploterrhist', … 'plotregression', 'plotfit'};
[net,tr] = train(net,inputs,targets);
outputs = net(inputs);
errors = gsubtract(targets,outputs);
performance = perform(net,targets,outputs)
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(net)

Best Answer

% 1. This is REGRESSION, not PREDICTION.
%2. Placeholders:
input = randn(48,206);
target = randn(5,48)*input.^2+randn(5,48)*input+ randn(5,206);
[ I N ] = size(input) % [ 48 206 ]
[ O N ] = size(target) % [ 5 206 ]
%3. N = 206 doesn't provide enough information to be using I = 48:
Ntrn = N - 2*round(0.15*N) % 144 training points
Ntrneq = Ntrn*O % 720 No. of training equations
% Nw = (I+1)*H+(H+1)*O No. of weights for an I-H-O net
% Nw > Ntrneq <==> H > Hub
Hub = (0.7*N-O)/(I+O+1) % 2.6 to 2.9 for O = 5 to 1
% Therefore, regardless of O, the net is OVERFIT when H >= 3
% 4. Remedies:
a. H <= 2 and/or
b. Validation Stopping and/or
c. TRAINBR Regularization and/or
d. MSEREG Regularization and/or
e. Input variable Reduction
% 5. I recommend trying 4e first. To get a feel for the data, you could
a. Standardize all variables with zscore or mapstd
b. Create 48 graphs with the 5 targets plotted vs each input
c. Remove or modify outliers
d. Obtain the 54 x 54 correlation coefficient matrix
e. Consider multiple single output models
f. Use STEPWISEFIT and/or STEPWISE on a linear model
Good Luck.
P.S. I try not to waste my time by using statements that just assign default parameter values
Hope this helps.
Thank you for formally accepting my answer
Greg