Struggling to Improve Neural Network Performance
Afficher commentaires plus anciens
I am working on creating a function fitting neural network with the neural network toolbox but I haven't had much success getting it to work correctly. I have an input matrix with two features. I currently use fitnet (I've tried cascadeforwardnet/feedforwardnet without much difference) and have two hidden layers, each with 10 neurons. I've been using `trainbr` because it has given me better results than `trainlm`. I'm trying to normalize or standardize the data but haven't had much success. I know that fitnet uses mapminmax by default and I've seen Greg Heath's suggestion that I use zscore to standardize first. The problem is, every time I've used the zscore standardization I haven't gotten very good neural network results. My output needs to be completely positive after de-standardization yet I still get negative values. Because of this, I have used log10 to normalize the data, therefore keeping all of the values positive.
In order to see prediction error, I have found the maximum percent error at any individual output point. I cannot get error lower than 40%, and there are multiple other points with decently high error.
Is there anything else that I can do, whether it be normalization/standardization or network reconfiguration to improve my network performance?
EDIT:
I'm not sure if this is of any help but the regression plot shows that the R = 0.99984 so it seems very accurate.
Thank you for the help,
George
Réponse acceptée
Plus de réponses (1)
Greg Heath
le 7 Juil 2016
> I have an input matrix with two features.
[ I N ] = size(input) % [ 2 N ], N = ?
[ O N ] = size(target)% [ O N ], O = ?
> I currently use fitnet ... and have two hidden layers, each with 10 neurons.
A single hidden layer is sufficient.
With no regularization, number of "H"idden neurons, H, is
limited by the number of equations Neq = N*O
> I've been using trainbr`because it has given me better results than trainlm.
TRAINBR uses regularization which mitigates using a large H.
> I'm trying to normalize or standardize the data but haven't had much success. I know that fitnet uses mapminmax by default and I've seen Greg Heath's suggestion that I use zscore to standardize first.
I use zscore in order to detect outliers which may have to be modified or deleted.
> The problem is, every time I've used the zscore standardization I haven't gotten very good neural network results.
Perhaps you misused it. I cannot tell you how without details.
> My output needs to be completely positive after de-standardization yet I still get negative values. Because of this, I have used log10 to normalize the data, therefore keeping all of the values positive.
I don't think log10 is sufficient for positivity. The best way to impose output bounds is to use a bounded output transfer function like logsig or tansig
> In order to see prediction error, I have found the maximum percent error at any individual output point. I cannot get error lower than 40%, and there are multiple other points with decently high error.
If you are using fitnet, the default performance measure is MSE = mse(error). The corresponding scale free measures that are trivial to understand are
NMSE = MSE/mean(var(target',1)
and
Rsquare = 1 - NMSE
> Is there anything else that I can do, whether it be normalization/standardization or network reconfiguration to improve my network performance?
Using NMSE and Rsq are more reliable for measuring regression performance. I see no good reason for the log transformation
% EDIT: % % I'm not sure if this is of any help but the regression plot % shows that the R = 0.99984 so it seems very accurate.
Given your log transformation, I'm not sure just what that means. However, my guess is that it is good. Make sure by plotting unnormalized target and output on the same graph.
Hope this helps.
Thank you for formally accepting my answer
Greg
5 commentaires
George Tsitsopoulos
le 7 Juil 2016
Modifié(e) : George Tsitsopoulos
le 7 Juil 2016
Greg Heath
le 8 Juil 2016
For the use of zscore in the NN Toolbox consider the following:
close all, clear all, clc
x = 10*randn(4,5) + 10*rand(4,5);
[I N ] = size(x) % [ 4 5 ]
meanx = repmat(mean(x')',1,N);
stdx1 = repmat(std(x',1)', 1,N);
z0 = (x-meanx)./stdx1;
z = zscore(x',1)';
minmaxdz = minmax(z-z0) % [ 0 0 ]
minmaxdzp = minmax(z'-z0') % [ 0 0 ]
whos
% Name Size Bytes Class
%
% I 1x1 8 double
% N 1x1 8 double
% meanx 4x5 160 double
% minmaxdz 4x2 64 double
% minmaxdzp 5x2 80 double
% stdx1 4x5 160 double
% x 4x5 160 double
% z 4x5 160 double
% z0 4x5 160 double
Hope this helps
Greg
George Tsitsopoulos
le 12 Juil 2016
Greg Heath
le 12 Juil 2016
> Unfortunately, there is still error around 2000% at certain points.
For regression, the only type of measure that makes sense is one that is linear w.r.t. MSE, the measure that you are trying to minimize directly. The most commonly used are the normalized mse
NMSE = mse(error)/mean(var(target',1))
and the corresponding R squared (see Wikipedia)
Rsq = 1 - NMSE
The denominator of NMSE is the smallest mse that could occur from the naive model output = constant. The minimizing solution is output = mean(target')'.
> You said that the number of hidden neurons is limited by the number of hidden equations. In your equation above, N=1767 and O=1 so I can have a maximum of 1767 neurons, correct?
No.
Using the default data division ratios of /0.7/0.15/0.15 yields the number of training examples
Ntrn = N - 2*round(0.15*N) %1237
and corresponding number of TRAINING equations
Ntrneq = Ntrn*O % 1237
To avoid the phenomenon of overfitting when using the default training function TRAINLM, keep the number of unknown weights
Nw = (I +1)*H+(H+1)*O
no greater than Ntrneq. However, for the purpose of numerical stability w.r.t. noise and measurement error, it should be considerably less.
Accordingly, Nw << Ntrneq yields the upper bound and reasonable maximum
H <= Hmax << Hub = (Ntrneq-O)/(I+O+1) = 309
Therefore I would probably first consider the 10 values
h = Hmin:dH:Hmax = 3:3:30
with
Ntrials = 1:10
random sets of initial weights and datadivisions each. Then display the 10x10 array of Rsq as I have done in many posted examples.
> You also said that bayesian regularization limits the number of hidden neurons further.
That is not what I meant. If you have to increase Hmax too much e.g., Hmax >~ Hub/2 ~ 155 then you should consider trainbr whos output is much more insensitive to overfitting.
> Could it be that 15 hidden neurons is too few?
That will be revealed as a product of the double loop search over h and Ntrials.
> Also, is there a way to bound my output so it is always positive? A negative output is impossible in the real world yet the neural net has several points that are output as negative.
Using a bounded output transfer function will keep the output within bounds. Either TANSIG or LOGSIG will work. The scaling to your data will be done automatically.
Hope this helps.
Greg
George Tsitsopoulos
le 13 Juil 2016
Catégories
En savoir plus sur Define Shallow Neural Network Architectures dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

