I am trying to perform in python, cross-validation. My databaset have size 31x9. I want to split the matrix into matrixes with size 28 and 3 for the evaluation. Moreover in the test matrix I want to replace the last two columns equal to zero. My code is the following:
def printme(training):
train_list = []
test_list = []
num_folds = 10
subset_size = len(training)/num_folds
for i in range(num_folds):
testing_this_round = training[i*subset_size:][:subset_size]
training_this_round = training[:i*subset_size] + training[(i+1)*subset_size:]
train_list.append(training_this_round)
new_test = testing_this_round
new_test[0][8] = 0
new_test[1][8] = 0
new_test[2][8] = 0
new_test[0][7] = 0
new_test[1][7] = 0
new_test[2][7] = 0
test_list.append(new_test)
return train_list, test_list
The crossvalidation seems to work fine, however when I am trying to make the last two columsn of test matrix equal to zero, I entounted problems. It seems that my code affect also the training matrix. How can I overcome this problem? In the returned matrices train_list and test_list in both of them the last two columns was changed to zero.