Hi!
I'm working with Neural Networks and I'd like to compare two different sets of data to train my NN. Thus, I'd like to train and validate my network with the same samples in order to compare which set is better to train my network and to be able to quantify its improvement. For this purpose I'm training the network with the first set, which is a 8x1464 matrix, and saving its divide parameters, which are: train indexes (tr.trainInd, which is a 1x1024 matrix), validation indexes (tr.valInd, 1x220) and test indexes (tr.testInd, 1x220) with the following code:
train=tr.trainInd;
val=tr.valInd;
test=tr.testInd;
After this, I restart my NN and set its divide parameters to the previous ones with:
net.divideFcn='divideind';
net.divideParam.trainInd=train;
net.divideParam.valInd=val;
net.divideParam.testInd=test;
Then, I try to train the network with the new set, which is a 21x1464 matrix (same samples with more parameters), but the message " Indexing cannot yield multiple results " appears. I don't understand why this message appears, as both sets contain 1464 samples and thus, divide indexes should be fine.
Thanks in advance for your help!

댓글 수: 1

Walter Roberson
Walter Roberson 2015년 5월 19일
Please show the exact error message including the tracing of the line of code it was executing

댓글을 달려면 로그인하십시오.

 채택된 답변

Greg Heath
Greg Heath 2015년 5월 19일

1 개 추천

First:
train = tr.trainInd;
is not allowed because train is a reserved word.
I use
trnind, valind, and tstind.
Notice the lower case i and the abbreviations of train and test.
Second:
If you want to use divideind, divide BEFORE TRAINING. For example:
N = 110
[trnind,valind,tstind]=divideind(N,1:2:100,4:2:48,52:2:108);
net.divideFcn = 'divideind';
net.divideParam.trainInd = trnind;
net.divideParam.valInd = valind;
net.divideParam.testInd = tstind;
Notice that not all of the data is used.
Third:
Reread the documentation
help divideind
doc divideind
Hope this helps.
Thank you for formally accepting this answer
Greg

댓글 수: 1

Iván Martínez
Iván Martínez 2015년 5월 19일
That was my problem: train was a reserved word. It totally worked when I changed the name of those variables. I was just coming to close the question when I saw your answer. Thank you very much!

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Walter Roberson
Walter Roberson 2015년 5월 19일

1 개 추천

I think it means you have duplicate indexes. check:
if length(unique(train)) ~= length(train)
disp('duplicate indices in train');
end
if length(unique(val)) ~= length(val)
disp('duplicate indices in val');
end
if length(unique(test)) ~= length(test)
disp('duplicate indices in test');
end
if ~isempty(intersect(train,val))
disp('train and val overlap');
end
if ~isempty(intersect(train,test))
disp('train and test overlap');
end
if ~isempty(intersect(test,val));
disp('test and val overlap');
end

댓글 수: 1

Iván Martínez
Iván Martínez 2015년 5월 19일
No, I already checked that before posting this question and that was not the thing. By the way, the problem is now fixed. But thank you very much for your answer!!

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Deep Learning Toolbox에 대해 자세히 알아보기

질문:

2015년 5월 19일

댓글:

2015년 5월 19일

Community Treasure Hunt

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

Start Hunting!

Translated by