neural network poor performance

7 visualizzazioni (ultimi 30 giorni)
noclah
noclah il 14 Dic 2011
Hello this is the first time I work with the neural network toolbox, I designed a network using newff, the goal is to approximate the input vector wich is a 4x600 matrix of MAV's taken from 4 muscles, to an output an expected angle.
however when I look at the regression plot, I'm getting a very low regression index, R=0.16882, the fit line it's almost horizontal and there is a lot of dispersion.
If someone could point me out in the right direction, I'd be gratefull.
Here is my code:
net = newff(Input,Target,20);
net.trainParam.goal=1e-6;
net.trainParam.max_fail=6;
net.performFcn='msereg';
net.performParam.ratio=0.5;
net,tr] = train(net,Input,Target);
yTargets = sim(net,Input);
plotregression(Target,yTargets);
  2 Commenti
noclah
noclah il 14 Dic 2011
Also, I'm using trainlm, an I noticed that it stops, because it reaches validation checks to quickly.
Hessam
Hessam il 6 Gen 2012
I think you should change the parameter"net.divideFcn"to "dividerand". It's the default option for the nn when you do not specify the divide function explicitely. then you should use the following parameters to change the ratios of each part:
net.divideParam.trainRatio = 50/100;
net.divideParam.valRatio = 5/100;
net.divideParam.testRatio = 35/100;
However the validation check(the following parameter() is a very tricky part:
net.trainParam.max_fail
Hessam

Accedi per commentare.

Risposta accettata

Greg Heath
Greg Heath il 16 Dic 2011
Find, H, the smallest number of hidden nodes that will yield a satifactory design by looping over nH candidate values and trying Ntrials different designs for each value of H. Then choose the best of the nH*Ntrials designs.
I typically look at nH = 10, Ntrials = 10 first. Then accept or modify depending on the result.
Hope this helps.
Greg
  2 Commenti
noclah
noclah il 21 Dic 2011
Thanks Greg, I have tried that too. I choose to change the network structure. Now I have a 4-20-20-1 network, this time something else happened, when I use the plotregression command, I get a very good regression index for the training set .9998 after 500 epochs, however for the validation and test set, I get .007 and .19 respectively, I suspect I need to modify the error, but I still dont know how to do it.
Here is my network:
net =
Neural Network object:
architecture:
numInputs: 1
numLayers: 3
biasConnect: [1; 1; 1]
inputConnect: [1; 0; 0]
layerConnect: [0 0 0; 1 0 0; 0 1 0]
outputConnect: [0 0 1]
numOutputs: 1 (read-only)
numInputDelays: 0 (read-only)
numLayerDelays: 0 (read-only)
subobject structures:
inputs: {1x1 cell} of inputs
layers: {3x1 cell} of layers
outputs: {1x3 cell} containing 1 output
biases: {3x1 cell} containing 3 biases
inputWeights: {3x1 cell} containing 1 input weight
layerWeights: {3x3 cell} containing 2 layer weights
functions:
adaptFcn: 'trains'
divideFcn: 'dividerand'
gradientFcn: 'gdefaults'
initFcn: 'initlay'
performFcn: 'mse'
plotFcns: {'plotperform','plottrainstate','plotregression'}
trainFcn: 'trainlm'
parameters:
adaptParam: .passes
divideParam: .trainRatio, .valRatio, .testRatio
gradientParam: (none)
initParam: (none)
performParam: (none)
trainParam: .show, .showWindow, .showCommandLine, .epochs,
.time, .goal, .max_fail, .mem_reduc,
.min_grad, .mu, .mu_dec, .mu_inc,
.mu_max
weight and bias values:
IW: {3x1 cell} containing 1 input weight matrix
LW: {3x3 cell} containing 2 layer weight matrices
b: {3x1 cell} containing 3 bias vectors
other:
name: ''
userdata: (user information)
Train Parameters:
show: 50
showWindow: 1
showCommandLine: 0
epochs: 1000
time: Inf
goal: 0.0100
max_fail: 500
mem_reduc: 1
min_grad: 1.0000e-010
mu: 0.0500
mu_dec: 0.1000
mu_inc: 10
mu_max: 1.0000e+010
I'm getting close, yet I'm still too far. Thanks.
Greg Heath
Greg Heath il 8 Gen 2012
>Thanks Greg, I have tried that too.
Hmm. Since that has ALWAYS worked for me, I would like to see your code.
Hope this helps.
Greg

Accedi per commentare.

Più risposte (2)

Mo al
Mo al il 14 Dic 2011
you have to show your code. very quick suggestions 1- increase your performance goal. 2- initiate your network

Hessam
Hessam il 6 Gen 2012
Just as a very important point in my work: How does the Performance function calculate the "mse"? is it normalized? otherwise it would be useless.
  1 Commento
Greg Heath
Greg Heath il 8 Gen 2012
MSE = mse(target-output)
It can be normalized by MSE00, the MSE obtained from the naive constant model:
output00 = repmat(mean(target,2),1,Ntrn)
MSE00 = mse(target-output00)
NMSE = MSE/MSE00 % normalized MSE
R2 = 1 - NMSE % R^2 statistic
Useless might be an appropriate characterization for multiple output
nets when the outputs have different scales. Therefore, if outputs have different scales, it would be wise to normalize them.
For regression with multiple real-valued outputs, I prefer standardization (zero-mean/unit-varance).
For classification among c classes, using targets that are columns of the c-dimensional unit matrix eye(c) is sufficient.
Hope this helps.
Greg

Accedi per commentare.

Categorie

Scopri di più su Sequence and Numeric Feature Data Workflows in Help Center e File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by