Divide training , validation and testing data.

10 ビュー (過去 30 日間)
Sujith Jacob
Sujith Jacob 2022 年 6 月 27 日
回答済み: Image Analyst 2022 年 6 月 27 日
How can I divide only training and validation data randomly and have a separate contingous block for testing data.
for eg. if I have 2000 target points. I want to have randomly selected points from first 1500 points for training and validation but for testing I want 1501 to 2000 target points.

採用された回答

KSSV
KSSV 2022 年 6 月 27 日
A = rand(2000,3) ; % your data
Test = A(1501:end,:) ; % take test continuously
A = A(1:1500,:) ; % pick the left data
A = A(randperm(1500,1500),:) ; % randomise the data
train_idx = round(70/100*1500) ; % 70% training
Train = A(1:train_idx,:) ;
Valid = A(train_idx+1:end,:) ;
  2 件のコメント
Sujith Jacob
Sujith Jacob 2022 年 6 月 27 日
thank you for the help
KSSV
KSSV 2022 年 6 月 27 日
Thanks is accepting/ votinng the answer... :)

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

その他の回答 (1 件)

Image Analyst
Image Analyst 2022 年 6 月 27 日
Depends on what kind of network training you're doing. If you're using trainNetwork and labels, then you can use imageDatastores and the function splitEachLabel
% Split the image data store into 80% for training, 10% for validation, and 10% for testing.
[trainingSet, validationSet, testSet] = splitEachLabel(imds, 0.8, 0.1);

カテゴリ

Help Center および File ExchangeDeep Learning Toolbox についてさらに検索

製品


リリース

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by