我正在编写自定义GridSearchCV的代码。每次执行代码时,我希望选择和随机排列indies(索引)。但是我无法弄清如何将种子函数实现到其中。以下是我的代码片段,请告诉我是否需要进行任何添加。
代码:
train_indices=random.sample(range(0,len(x_train)),int(folds_percent*len(x_train)))
test_indices=list(set(list(range(1,len(x_train))))-set(train_indices))
感谢您的帮助!|:-)
random.seed()
来完成这个任务。请参考https://docs.python.org/2/library/random.html。 - Joe