Best way to split data into random partitions?

8 次查看(过去 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.
How would I be able to do this?
classOne and classTwo is 10000x2 double histogram

采纳的回答

Cris LaPierre
Cris LaPierre 2019-1-12
编辑:Cris LaPierre 2019-1-12
I would use the dividerand function in the Deep Learning Toolbox.
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
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 CenterFile Exchange 中查找有关 Statistics and Machine Learning Toolbox 的更多信息

标签

产品


版本

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by