필터 지우기
필터 지우기

dividerand followed by divideind doesn't seem to work?!?!

조회 수: 1 (최근 30일)
Brent
Brent 2018년 12월 28일
댓글: Brent 2019년 1월 2일
Hi,
When I run the code below, the divideind seems to be totally ignored when training the neural net. It trains using the default dividerand.
Any ideas???
When looking at what tr returns we see:
divideFcn: 'dividerand' (I would expect it to say divideind)!
trainInd: [1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 19 21 22 23 24 25 26 27 28 29 30 31 33 34 35 36 37 39 41]
valInd: []
testInd: [17 18 20 32 38 40]
There should have been fewer in trinInd and more in testInd.
Thank you!
x = -1:0.05:1;
t = sin(2*pi*x) + 0.1*randn(size(x));
[trainT,valT,testT] = dividerand(length(t),.55,.25,.20) % maybe make eval percentage 0 if trainbr, but not necessary since:
% "Validation stops are disabled by default (max_fail = 0) so that
% training can continue until an optimial combination of errors and
% weights are found"?
trainTsave = trainT;
valTsave = valT;
testTsave = testT; % save for use in all the NNs
% for trainbr we combine validation and test and call them all test
[trainInd,valInd,testInd] = divideind(length(t),trainTsave,[],[valTsave,testTsave]) % order of values in testInd is wrong?????????????? But is it a problem???
net = fitnet([20,20],'trainbr'); % [20,10] means 2 hidden layers 1st w size 20 & 2nd w size 10
% help(net.trainFcn) to see the default settings
% disable fitnet from using mapminmax if using my scaling algo?
[net,tr] = train(net,x,t) % trains the NN and tr contains all kinds of metadata
view(net); % sb after train
y = net(x); % generate the predicted output values based on the NN with the inputs
perf = perform(net,y,t);

채택된 답변

Viren Gupta
Viren Gupta 2019년 1월 2일
You can set the properties of the 'net' here. Example:-
net.divideFcn = 'divideind';
net.divideParam.trainInd = trainInd;
net.divideParam.valInd = valInd;
net.divideParam.testInd = testInd;
Then you can again train the model. You can refer the following link that can help.
  댓글 수: 1
Brent
Brent 2019년 1월 2일
Thank you for your feedback. It turned out I needed to do two things, add the lines you suggested but i also needed to move the fitnet line so it happened before those lines.
I’m still unclear as why using the net.divideFcn, etc. lines work but the divideind command doesn’t; what use is the divideind command line?

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

추가 답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by