MATLAB Answers

how to split dataset

42 views (last 30 days)
muhammad ismat
muhammad ismat on 9 Jul 2015
Answered: muhammad ismat on 15 Apr 2016
can I select 90% of the data for training and the remaining (10%) for test set then repeat the split 10 times?How I do that?
and how to calculate final accuracy in this case.
  1 Comment
Azzi Abdelmalek
Azzi Abdelmalek on 9 Jul 2015
What is your data? a matrix or what? how your data will be stored? Post an example and show the expected result

Sign in to comment.

Answers (2)

muhammad ismat
muhammad ismat on 15 Apr 2016
n = size(data,1);
data_rand = data(randperm(n),:);
m = ceil(n/10);
k = 1:m:n-m;
test = data_rand(k:k+m-1,:);
train = [data_rand(1:k-1,:); data_rand(k+m:end,:)];
adj=edge(train,data);

muhammad ismat
muhammad ismat on 9 Jul 2015
i assume that dataset is k=[1 2;3 4;8 5;8 9;6 5] then train set is t=[1 2;3 4;6 5] and test set is the remaining i.e test=[8 5;8 9]
i want repeat this process 10 times with different choice but the same percentage
  2 Comments
muhammad ismat
muhammad ismat on 10 Jul 2015
No one responded

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!