def getTestAndTrainingSet(X,y,K=10):
N = len(X)
CV = cross_validation.KFold(N,K,shuffle=True)
k=0
for train_index, test_index in CV:
# extract training and test set for current CV fold
X_train = X[train_index,:]
y_train = y[train_index,:]
X_test = X[test_index,:]
y_test = y[test_index,:]
k+=1
if(k==K):
return (X_train,y_train),(X_test,y_test)
methods.py 文件源码
python
阅读 30
收藏 0
点赞 0
评论 0
评论列表
文章目录