Mercurial > hg > mauch-mirex-2010
annotate _FullBNT/KPMtools/rnd_partition.m @ 9:4ea6619cb3f5 tip
removed log files
author | matthiasm |
---|---|
date | Fri, 11 Apr 2014 15:55:11 +0100 |
parents | b5b38998ef3b |
children |
rev | line source |
---|---|
matthiasm@8 | 1 function [train, test] = rnd_partition(data, train_percent); |
matthiasm@8 | 2 % function [train, test] = rnd_partition(data, train_percent); |
matthiasm@8 | 3 % |
matthiasm@8 | 4 % data(:,i) is the i'th example |
matthiasm@8 | 5 % train_percent of these columns get put into train, the rest into test |
matthiasm@8 | 6 |
matthiasm@8 | 7 N = size(data, 2); |
matthiasm@8 | 8 ndx = randperm(N); |
matthiasm@8 | 9 k = ceil(N*train_percent); |
matthiasm@8 | 10 train_ndx = ndx(1:k); |
matthiasm@8 | 11 test_ndx = ndx(k+1:end); |
matthiasm@8 | 12 train = data(:, train_ndx); |
matthiasm@8 | 13 test = data(:, test_ndx); |