problem with train function neural networks

2 views (last 30 days)
a2m22
a2m22 on 29 Mar 2011
Hi
I have a problem with train function
??? Error using ==> network.train
Targets are incorrectly sized for network.
Matrix must have 2 columns.
Error in ==> tfarst1 at 14
[net,tr]=train(net,min_max,f);
>> whos
Name Size Bytes Class
Fs 1x1 8 double array
d 22050x1 176400 double array
f 1x432 3456 double array
h 1x1 8 double array
h1 1x1 8 double array
m 432x12 41472 double array
min_max 432x2 6912 double array
net 1x1 85013 network object
s 55512x1 888192 double array (complex)
Grand total is 92380 elements using 1201469 bytes
I only have one output for each row how can I fix it?and this is my code
clear;clc
Fs=11025;
d=wavread('alhai.wav');
s=specgram(d,512,Fs,kaiser(500,5),400);
s=s(:);
m=melcepst(s,Fs);
min_max=minmax(m);
[h h1] = size(m);
f=ones(1,h);
net=newff(min_max,[5 1],{'tansig','purelin'},'trainlm');
net.trainParam.show=500;
net.trainParam.goal=1e-5;
net.trainParam.epochs=5000;
[net,tr]=train(net,min_max,f);

Answers (1)

Peter Manley-Cooke
Peter Manley-Cooke on 30 Mar 2011
I have forgotten most of the NN stuff and I no longer have a toobbox but, have you tried
[net,tr]=train(net,min_max,f'); ^ adding the ' symbol to transpose the column array to a row array so that it matches the rows of the data?
Also, in newff, I would expect the dimensions to match the data, say [2 1], or better [2 5 1], or is this done automatically? I can't find documentation for newff.
Sorry I'm not more current.

Categories

Find more on Sequence and Numeric Feature Data Workflows 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!