Borrar filtros
Borrar filtros

Training and splitting a custom dataset

4 visualizaciones (últimos 30 días)
weam
weam el 29 de En. de 2023
Respondida: Sulaymon Eshkabilov el 29 de En. de 2023
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

Respuestas (1)

Sulaymon Eshkabilov
Sulaymon Eshkabilov el 29 de En. de 2023
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);

Categorías

Más información sobre Sequence and Numeric Feature Data Workflows en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by