Output data size does not match net.outputs{3}.size.
8 views (last 30 days)
Show older comments
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 Comments
Answers (1)
Ayush Aniket
on 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:
0 Comments
See Also
Categories
Find more on Deep Learning Toolbox 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!