Train and Simulate Neural Networks
4 views (last 30 days)
Show older comments
Hi All, I am a newbie so please bear with me.
I have a input file containing (17x127) data (Force) and a target file of (3x127)(True Stress).
I have written the following code for training the neural networks:
p=Force; t=T_Stress;
net =newff(minmax(p),[10,1],{'tansig','purelin'},'trainlm');
net.trainParam.lr = .05; %Learning Rate net.trainParam.epochs = 300; %Max Ephocs net.trainParam.goal = 1e-5; %Training Goal in Mean Sqared Error net.trainParam.show = 50; %# of ephocs in display
[net,tr1] = train(net,p,t); o1 = sim(net,p)
However I get the following errors:
??? Error using ==> trainlm at 109 Output data size does not match net.outputs{2}.size.
Error in ==> network.train at 107 [net,tr] = feval(net.trainFcn,net,X,T,Xi,Ai,EW,net.trainParam);
Any helps with the above errors are very much appreciate it.
3 Comments
Greg Heath
on 4 Sep 2012
NO!
You have defined a net with 1 output.
However, your target data has 3 outputs.
Fix your net = newff command.
Greg
Antonio Mathworks
on 20 May 2015
Get,
I think the question is related to a Matlab example at simplecluster_dataset command.
when running:
[x,t] = simplecluster_dataset;
plot(x(1,:),x(2,:),'+')
net = selforgmap([8 8]);
net = train(net,x,t);
The following error is returned:
Error using network/train (line 340) Output data size does not match net.outputs{1}.size.
Accepted Answer
Greg Heath
on 27 Apr 2012
[I N ] = size(p)
[ O N ] = size(t)
H = 10
net =newff(minmax(p),[H,O]);
[net,tr1] = train(net,p,t);
o1 = sim(net,p)
Hope this helps
Greg
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!