help in training a nueral network
1 view (last 30 days)
Show older comments
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
0 Comments
Accepted Answer
Greg Heath
on 8 Jan 2012
[ 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.
0 Comments
More Answers (0)
See Also
Categories
Find more on Define Shallow Neural Network Architectures in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!