Problem in neural training, regression plot

2 views (last 30 days)
I need to optimize the parameters of pid controller using neural network. I am using the following code for my work.
load inp
load out
file1=inp./20;
file2=out;
p=file1';
t=file2';
H = 15; % trial No. of hidden nodes for I-H-O node topology
net = newff(minmax(p),[ H 1 ], {'tansig' 'purelin'}, 'trainlm' );
net.trainParam.epochs=1000;
net.trainParam.goal=0;
net.trainParam.min_grad=1e-10;
net.trainParam.mu=0.001;
net.trainParam.mu_max=1e10;
net.trainParam.show=100;
net.trainParam.showCommandLine=0;
net.trainParam.lr=0.02;
net.divideFcn='';
[ net tr Y E ] = train(net,p,t);
sim(net,p)
where "inp" and "out" data are collected from the model as input and output of pid block. inp and out are a matrix of 775 X 1 elements.
But in the regression plot obtained after running the code, I only get a cluster of data at the bottom left corner, while it should be uniformly distributed along the fit line
Kindly help..

Accepted Answer

Greg Heath
Greg Heath on 8 May 2013
1. plot t vs p before calling newff
2. [ I N ] = size(p) = ?
3. ] O N ] = size(t) = ?
4. Neq = N*O % How many training equations?
5. Why H = 15 ?? It should be as small as possible to try to make Neq >> Nw. Otherwise you need to use a validation set or trainbr.
6. Nw = (I+1)*H+(H+1)*O % How many unknown weights?
7. Is Neq >> Nw ?
8. net = newff(minmax(p),[ H 1 ], {'tansig' 'purelin'}, 'trainlm' )
Warning: NEWFF used in an obsolete way.
In obs_use at 18
In newff>create_network at 127
In newff at 102
In Untitled0 at 19
See help for NEWFF to update calls to the new argument list.
9. What version of MATLAB and NNTBX do you have? (Type the command ver )
10. Why did you clutter up your code by expicitly specifying default parameters? Try net = newff(minmax(p),[H 1]) without the semicolon to see the defaults.
11. net.trainParam.lr is NOT a property of newff wnen using trainlm
12. Y is sim(net,p). Therefore don't need the last command
Hope this helps.
Thank you for formally accepting my answer
Greg

More Answers (0)

Community Treasure Hunt

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

Start Hunting!