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

8 Ansichten (letzte 30 Tage)
Amanuel Kachiko Kuno
Amanuel Kachiko Kuno am 7 Mär. 2024
Beantwortet: Ayush Aniket am 18 Jun. 2024
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 Kommentare
Alexander
Alexander am 7 Mär. 2024
Can you supply some code that throws this error?
Amanuel Kachiko Kuno
Amanuel Kachiko Kuno am 7 Mär. 2024
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);

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Ayush Aniket
Ayush Aniket am 18 Jun. 2024
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:

Kategorien

Mehr zu Deep Learning Toolbox finden Sie in Help Center und File Exchange

Tags

Produkte


Version

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by