wolffd@0: function [train, test] = rnd_partition(data, train_percent); wolffd@0: % function [train, test] = rnd_partition(data, train_percent); wolffd@0: % wolffd@0: % data(:,i) is the i'th example wolffd@0: % train_percent of these columns get put into train, the rest into test wolffd@0: wolffd@0: N = size(data, 2); wolffd@0: ndx = randperm(N); wolffd@0: k = ceil(N*train_percent); wolffd@0: train_ndx = ndx(1:k); wolffd@0: test_ndx = ndx(k+1:end); wolffd@0: train = data(:, train_ndx); wolffd@0: test = data(:, test_ndx);