フィルターのクリア

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