MATLAB: How to do a 50-50 split on data to obtain train and test datasets such that no value is common to both sets

machine learningsplittesttrain

I am new to matlab and I can't find a function to do this.

Best Answer

"The divide function is accessed automatically whenever the network is trained, and is used to divide the data into training, validation and testing subsets. If net.divideFcn is set to 'dividerand' (the default), then the data is randomly divided into the three subsets using the division parameters net.divideParam.trainRatio, net.divideParam.valRatio, and net.divideParam.testRatio. The fraction of data that is placed in the training set is trainRatio/(trainRatio+valRatio+testRatio), with a similar formula for the other two sets. The default ratios for training, testing and validation are 0.7, 0.15 and 0.15, respectively."
net.divideParam.trainRatio = 0.5;
net.divideParam.testRatio = 0.5;
net.divideParam.valRatio = 0;