Output data size does not match net.outputs{3}.size.

8 次查看(过去 30 天)
I = out.Input;
T = out.Output;
net=newff(minmax(I),[3,5,3],{'logsig', 'tansig','purelin'},'trainlm');
But what i get the error is :
Error using network/train (line 340)
Output data size does not match net.outputs{3}.size
Error in ANN (line 15)
net=train(net,I,T);% Start trining the network
But my inputs are:
out= 1x1SimulationOutput with in that
Input = 4000001x3
Output = 400000x3
I tried a lot Please help me as much as possible. thanks in advance for your guidance.
  2 个评论
Amanuel Kachiko Kuno
I = out.Input;
T = out.Output;
net=newff(minmax(I),[3,5,3],{'logsig', 'tansig','purelin'},'trainlm');
net.trainParam.show=1;
net.trainParam.epochs = 1000;
net.trainParam.goal =1e-12;
net=train(net,I,T);

请先登录,再进行评论。

回答(1 个)

Ayush Aniket
Ayush Aniket 2024-6-18
Hi Amanuel,
The error you encounter is due to the incorrect syntax of the inputs and targets to the neural network. The network expects the inputs in the form of RxQ1 matrix of Q1 (number of samples) representative R-element input vectors (number of features) and outputs as SNxQ2 matrix of Q2 representative SN-element target vectors. The correct method would be to transpose your I and T matrices as shown below:
%Considering I and T to be in the shape (400000 x 3)
I = out.Input;
T = out.Output;
net=newff(minmax(I'),[3,5,3],{'logsig', 'tansig','purelin'},'trainlm');
net.trainParam.show=1;
net.trainParam.epochs = 1000;
net.trainParam.goal =1e-12;
net=train(net,I',T');
You can access the documentation for newff function by using the command below:
help newff
Note - The newff function has been obsolete since a long time. You should use feedforwardnetwork function instead, and can read more about it at the following documentation link:

类别

Help CenterFile Exchange 中查找有关 Deep Learning Toolbox 的更多信息

标签

产品


版本

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by