Training and splitting a custom dataset

조회 수: 4 (최근 30일)
weam
weam 2023년 1월 29일
답변: Sulaymon Eshkabilov 2023년 1월 29일
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

답변 (1개)

Sulaymon Eshkabilov
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);

카테고리

Help CenterFile Exchange에서 Resampling Techniques에 대해 자세히 알아보기

태그

제품


릴리스

R2022b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by