Matlab randomly divides the test set for training

data = data(randperm(size(data,1)),:); %随机划分
ind = round(0.7 * size(data,1)); %按比例分

%data= data(randperm(length(data)));

trainData = data(1:ind, 1:end); %训练集
testData = data(ind+1:end, 1:end); %测试集

I encountered this problem when doing experimental training. I searched for some information, sorted it out and posted it, which can be used directly.

Guess you like

Origin blog.csdn.net/qq_40016005/article/details/121329907