Training and splitting a custom dataset
조회 수: 4 (최근 30일)
이전 댓글 표시
Hello there, everyone. I recently worked in Matlab using deep learning and made the dataset in the program, but I don't know how to split and train this data
DatasetMatlab.mat .... this dataset , and consist of three parts
parts :-
1- LabelData
2- DataSource
3- LabelDefinitions
댓글 수: 0
답변 (1개)
Sulaymon Eshkabilov
2023년 1월 29일
In this case, there are a few ways - cvpartition() and datasample() to split/partition the data into training and test data sets, e.g.:
X = INPUT_Data;
Y = OUTPUT_Data;
rng("default"); % For reproducibility
n = length(Y);
%% cvpartition()
C = cvpartition(n, "HoldOut", 0.25); % Randomly selected 25% of data are used for testing and 75% for training
INDEXtrain = training(C,1);
INDEXtest = ~ INDEXtrain;
X_test = X(INDEXtest,:);
Y_test = Y(INDEXtest,:);
X_train = X(INDEXtrain,:);
Y_train = Y(INDEXtrain,:);
...
%% datasample()
NSample = 200; % 200 data sets are taken randomly for training
[Xtrain, Xtrain_Idx] = datasample(XYData, NSample);
댓글 수: 0
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!