Ask Your Question

Revision history [back]

You can use TrainData classes. First create an object TrainData :

Ptr<ml::traindata> t=ml::TrainData::create(data, ROW_SAMPLE, label);

theh you use SetTrainTestSplitRatio to shuffle data. You can get test data and train data using getTestSample or getTrainSamples method

You can use TrainData classes. First create an object TrainData :

Ptr<ml::traindata> t=ml::TrainData::create(data, ROW_SAMPLE, label);

theh you use SetTrainTestSplitRatio to shuffle data. You can get test data and train data using getTestSample or getTrainSamples method

You can read this example too