how to divide the Dataset into xtrain xtest ytrain ytest
14 次查看(过去 30 天)
显示 更早的评论
更多回答(2 个)
Chunru
2022-4-25
编辑:Chunru
2022-4-25
% doc cvpartition
data = randn(2310, 25);
%cv = cvpartition(2310, 'Holdout', 0.3);
%idxTrain = training(cv);
%idxTest = test(cv);
cv = cvpartition(2310, 'KFold', 10);
idxTrain = training(cv, 1);
idxTest = test(cv, 1);
traindata = data(idxTrain, :);
testdata = data(idxTest, :);
whos
5 个评论
Chunru
2022-4-28
I don't have your data so that I have to assume the dimension.
You can always read in the data and find the dimension.
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!