Neural Network Data division
5 次查看(过去 30 天)
显示 更早的评论
Hi all,
I am trying to build up a NN model in Matlab 2008a.
I am dividing the dataset using the following command
net.divideParam.trainRatio = 0.6;
net.divideParam.valRatio = 0.2;
net.divideParam.testRatio = 0.2;
Now after training, I want to have those datasets (_i.e._ target and network output only) that were used for training, testing and validation in three different files so that I can manually do the regression analysis. Can anyone please suggest the suitable command to so this.
Thanks for your kind help.
采纳的回答
Luca Cavazzana
2011-12-13
after calling train you get as second input argument the training record tr. The attribute testMask{1} contains a matrix (the same size of the input matrix) whose value are 1 if the element is in the training set, NaN otherwise. You can find indices this way:
[net, tr] = train(net, input, targets);
testInd = find(~isnan(tr.testMask{1}(1,:)));
inputTest = input(:,testInd);
targetTest = target(:,testInd);
In the same way, trainMask{1} and valMask{1} gives you the training and validation mask.
edit: instead of the whole testInd=find(...) thing, I forgot there's already the attribute tr.testInd
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Sequence and Numeric Feature Data Workflows 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!