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

回答(1 个)

Sulaymon Eshkabilov
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 中查找有关 Sequence and Numeric Feature Data Workflows 的更多信息

标签

产品


版本

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by