help in training a nueral network

hello; i need to train a feed forward neural network using trainlm ;i used this code but i did not get the result until i used 650 neurons in the hidden layer which is too big , i need some one to help me to reduce this number and get the results
p=[ 28220 22142 28395 23145];
t=[24930 25444 25958 26472];
net=newff(minmax(p),[100,1],{'tansig','purelin'},'trainlm');
%[net,TR] = trainlm(net,Pd,Tl,Ai,Q,TS,VV,TV)
%info = trainlm(code)
net.trainParam.epochs=100
net.trainParam.goal=0.01
net.trainParam.max_fail=1000
net.trainParam.mem_reduc=100
net.trainParam.min_grad=10e-10
net.trainParam.mu=0.0001
net.trainParam.mu_dec=0.001
net.trainParam.mu_inc=100
net.trainParam.mu_max=100e10
net.trainParam.show=25
net.trainParam.time=inf
[net,tr]=train(net,p,t)
y2 = sim(net,p)
thnx

 Réponse acceptée

Greg Heath
Greg Heath le 8 Jan 2012

0 votes

[ I N ] = size(p) % [1 4]
[ O N ] = size(t) % [ 1 4]
Neq = N*O % 4 No. of training equations
Nw = (I+1)*H + (H+1)*O % No of unknown weights for I-H-O node topology.
When training to convergence without regularization (e.g., TRAINBR), and/or Early Stopping with a validation set, require Neq >= Nw or H <= (Neq-O)/(I+O+1) = 1
However, desire Neq >> Nw or H << (Neq-O)/(I+O+1) to mitigate noise and neasurement errors.
Therefore, either get more data, use H = 1 or use a linear model (H=0).
Only override the net = newff(..) and net.trainParam.* defaults if absolutely necessary. See doc newff and doc train or doc trainlm for a list of defaults.
Hope this helps.
Greg.
P.S. Try fitting one period of a sine wave.

Plus de réponses (0)

Catégories

En savoir plus sur Deep Learning Toolbox dans Centre d'aide et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by