user1153308
user1153308

Reputation: 119

25 vectors, 3 dimension output neural network

How do I get rid of the error. I can't seem to train my neural network for a 3 dimensional output. The error says

??? Error using ==> network.sim at 178 Inputs are incorrectly sized for network. Matrix must have 1 rows.

Error in ==> testtt at 10

 Y = sim(net,P);
 addpath('data')
 load('ComPoles_Cir_Cy_Rect')
 load('target_row')
 P = Poles_Circle_10cm;
 T = Poles_Rectangular_40cm;
 m = min(min(P));
 mx = max(max(P));

 net = newff([m mx],[10 10 1],{'tansig' 'tansig' 'purelin'});
 Y = sim(net,P);
 plot(P,T,P,Y,'o')

 net.trainParam.epochs = 150;
 net = train(net,P,T);
 Y = sim(net,P);
 plot(P,T,P,Y,'o')    `

Upvotes: 0

Views: 1047

Answers (2)

Matteo De Felice
Matteo De Felice

Reputation: 1518

Obviously, without any information about the size of P and m I can guess what is the problem in this case. MATLAB NN Toolbox wants input and output vectors with data ordered in columns, this means that if you have a Neural Network with X inputs, you must use a matrix with X rows and N columns, with N the number of input samples. The same for output data. This is the most common error with NN Toolbox during its learning.

Upvotes: 0

Hannes Ovrén
Hannes Ovrén

Reputation: 21851

The error message is clear enough: It expected a matrix with one row (a 1xM matrix), and it got something else.

Now, hopefully, this means that you only need to transpose some matrix in your code, and it should work. Otherwise, you are probably using the function wrong, and you need to do some more thinking about what you are trying to do.

Upvotes: 1

Related Questions