Best way to split data into random partitions?
13 ビュー (過去 30 日間)
古いコメントを表示
I am new to Matlab and still a student. For an assignment, I am stuck on this part.
Create 5 random partitions of the data, splitting each of the classes into 60% training and 40% testing.
I have two classes, Class One and Class Two.
I was reading this https://www.mathworks.com/matlabcentral/answers/377839-split-training-data-and-testing-data
How would I be able to do this?
classOne and classTwo is 10000x2 double histogram
0 件のコメント
採用された回答
Cris LaPierre
2019 年 1 月 12 日
編集済み: Cris LaPierre
2019 年 1 月 12 日
For example
[trainInd,valInd,testInd] = dividerand(3000,0.6,0.2,0.2);
Just set the validation percentage to 0 if you don't need it.
5 件のコメント
David Goodmanson
2019 年 1 月 12 日
HI Masaki,
Neither do I, but you can use somthing more basic like RandInd = randperm(n), which creates a vector containing a random arrangement of the numbers 1:n. Then you can take the first 60% (or whatever) of RandInd to be TrainInd, etc. and proceed from there.
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Get Started with Statistics and Machine Learning Toolbox についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!