필터 지우기
필터 지우기

divide data set in matlab code

조회 수: 2 (최근 30일)
Suzanne Hussein
Suzanne Hussein 2015년 5월 17일
댓글: Walter Roberson 2015년 5월 17일
How can divide dataset into 80% training set and 20% test set in matlab code??

답변 (2개)

Walter Roberson
Walter Roberson 2015년 5월 17일
nrows = size(YourData,1);
r80 = round(0.80 * nrows);
trainingset = YourData(1:r80,:,:);
testset = YourData(r80+1:end,:,:);
  댓글 수: 3
Suzanne Hussein
Suzanne Hussein 2015년 5월 17일
?? 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 2015년 5월 17일
You are using an old version of MATLAB. The equivalent code is
rand80 = randperm(nrows);
rand80 = rand80(1:r80);

댓글을 달려면 로그인하십시오.


Image Analyst
Image Analyst 2015년 5월 17일
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
Suzanne Hussein
Suzanne Hussein 2015년 5월 17일
my dataset is 99X13 double, 12 Dimensions and last column is label of classes

댓글을 달려면 로그인하십시오.

Community Treasure Hunt

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

Start Hunting!

Translated by