Is there a way to obtain the indices of the training, validation and test datasets in NN pattern recognition?

2 ビュー (過去 30 日間)
Let's say I feed a 100*3 matrix as a input and a 100*1 matrix as target datset to the NN pattern regonition app. As per the default setting it will randomly select 70% of the data as the training set, 15% as Validation test and 15% as testing set right? Now, I carry out a number of iterations to train the network and let's say I decide to select the model with the least error in the test set as my final model. So, Is there any way to get the indices of the dataset that was selected as the training, validation and the test set for my final model. I want to use these sets to train/evaluate the performance of the other models I have.
I hope my question was clear. If not, please let me know. I greatly appreciate your time andd help in answering my question.
Thanks!

採用された回答

Gifari Zulkarnaen
Gifari Zulkarnaen 2020 年 7 月 14 日
You can see those indices in the ouput data of train command.
[net,tr] = train(net,x,t); % net is trained network, tr in training information
% Indices:
train_index = tr.trainInd;
validation_index = tr.valInd;
test_index = tr.testInd;
If you want to use saved indices for other training, you can divide the dataset using user-defined indices (before train the network) using divideind option:
net.divideFcn = 'divideind';
net.divideParam.trainInd = train_index;
net.divideParam.valInd = validation_index;
net.divideParam.testInd = test_index;
  1 件のコメント
Gunjan Rateria
Gunjan Rateria 2020 年 7 月 14 日
編集済み: Gunjan Rateria 2020 年 7 月 14 日
Thank you Gifari for the precise response I was looking for :) It works like a charm!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSequence and Numeric Feature Data Workflows についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by