How to randomly generate a subset of samples?

asked 2018-01-02 11:21:46 -0500

waschbaer gravatar image

Hi,

I have a dataset and I want to generate a subset by randomly select 70% of the whole dataset. I know cv::RNG::fill(....) generates random integers in a range, but I guess the generated numbers will repeat.

Is there any function in opencv can provide such functionality?

Thank you.

Best, bear

edit retag flag offensive close merge delete

Comments

1

are you using this for machinelearning ?

you could use the TrainData class, it has methods to split your dataset randomly

also: randShuffle()

berak gravatar imageberak ( 2018-01-02 11:39:06 -0500 )edit
1

Just for the record, these are pseudorandom numbers, not random numbers.

sjhalayka gravatar imagesjhalayka ( 2018-01-02 13:00:54 -0500 )edit