How do i use divideblock to split my Datasets (5,749 images) in 80-20 split to obtain training and test datasets only?

2 visualizaciones (últimos 30 días)
How do i use divideblock to split my Datasets (5,749 images) in 80-20 split to obtain training and test datasets only. Upon running my code below, number of images in trainingA = (1*4001) and testA = (1*999 double) which is less than 5,749
Code: [trainA, testA] = divideblock(5749, 0.8, 0.2);
I will appreciate suggestions of other options.

Respuesta aceptada

KSSV
KSSV el 16 de Mzo. de 2018
N = 5749; % number of images
idx = 1:N ;
PD = 0.80 ;
train_idx = idx(1:round(PD*N) ; % training indices
test_idx = idx(round(PD*N):end,:) ; % test indices
  1 comentario
Chidiebere Ike
Chidiebere Ike el 16 de Mzo. de 2018
Thanks for your response. Based on your reply, am I expected to input Ptest = 0.20; (on 20% ratio of test images) to indicate test % as I stated below? Please guide me.
N = 5749; % number of images idx = 1:N ; Ptrain = 0.80 ; Ptest = 0.20 ; train_idx = idx(1:round(Ptrain*N);% training indices test_idx = idx(1:round(Ptest*N)) ; % test indices

Iniciar sesión para comentar.

Más respuestas (0)

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by