adding
[mlfp.git] / matlab / split_X.m
blobd13428ff66c706dd5e7872167f10057cd076bc7c
1 function [train test] = split_X(X, prob)\r
2 \r
3 train.varmap = X.varmap;\r
4 test.varmap = X.varmap;\r
5 \r
6 next_train = 1;\r
7 next_test = 1;\r
8 for i=1:size(X.obs, 2)\r
9     if rand(1, 1) < prob\r
10         train.obs(next_train) = X.obs(i);\r
11         next_train = next_train + 1;\r
12     else\r
13         test.obs(next_test) = X.obs(i);\r
14         next_test = next_test + 1;\r
15     end\r
16 end