shuffle

671 ワード

  shuffle
(1)  1:
X_train,X_test, y_train, y_test = cross_validation.train_test_split(all_train_data,all_label,test_size=0.4, random_state=0)
 

(2)方法2
x1 = np.array(question_list)
x2 = np.array(candidate_path_list)
np.random.seed(10)
shuffle_indices = np.random.permutation(np.arange(len(x1)))
x1_all = x1[shuffle_indices]
x2_all = x2[shuffle_indices]
dev_sample_index = int(0.9 * float(len(x1)))
x1_train, x1_test = x1_all[:dev_sample_index], x1_all[dev_sample_index:]
x2_train, x2_test = x2_all[:dev_sample_index], x2_all[dev_sample_index:]