Borrar filtros
Borrar filtros

divide data set in matlab code

2 visualizaciones (últimos 30 días)
Suzanne Hussein
Suzanne Hussein el 17 de Mayo de 2015
Comentada: Walter Roberson el 17 de Mayo de 2015
How can divide dataset into 80% training set and 20% test set in matlab code??

Respuestas (2)

Walter Roberson
Walter Roberson el 17 de Mayo de 2015
nrows = size(YourData,1);
r80 = round(0.80 * nrows);
trainingset = YourData(1:r80,:,:);
testset = YourData(r80+1:end,:,:);
  3 comentarios
Suzanne Hussein
Suzanne Hussein el 17 de Mayo de 2015
?? Error using ==> randperm Too many input arguments.
Error in ==> dividet at 3 rand80 = randperm(nrows,r80); how can i solve it?
Walter Roberson
Walter Roberson el 17 de Mayo de 2015
You are using an old version of MATLAB. The equivalent code is
rand80 = randperm(nrows);
rand80 = rand80(1:r80);

Iniciar sesión para comentar.


Image Analyst
Image Analyst el 17 de Mayo de 2015
randperm() is probably the function you're looking for. We can help more if you say what your dataset is.
dataset is a deprecated variable type - the Mathworks recommends that you use a table instead.
  1 comentario
Suzanne Hussein
Suzanne Hussein el 17 de Mayo de 2015
my dataset is 99X13 double, 12 Dimensions and last column is label of classes

Iniciar sesión para comentar.

Community Treasure Hunt

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

Start Hunting!

Translated by