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.
참고 항목
카테고리
Help Center 및 File Exchange에서 Modeling and Prediction에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!