Created
January 2, 2016 18:03
-
-
Save limzunyuan/bffe7e630a364ac833d8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% Returns indices for training set and test set | |
% e.g. partition(1) => [1:900 , 901:1004] | |
function [training_idx testing_idx] = partition(ith_partition, x2) | |
nrows = size(x2, 2); | |
test_set_start_index = floor((ith_partition - 1) / 10 * nrows) + 1; | |
test_set_end_index = floor(ith_partition / 10 * nrows); | |
testing_idx = test_set_start_index:test_set_end_index; | |
training_idx = setdiff(1:nrows, testing_idx); | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment