methods.py 文件源码

python
阅读 30 收藏 0 点赞 0 评论 0

项目:South-African-Heart-Disease-data-analysis-using-python 作者: khushi4tiwari 项目源码 文件源码
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)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号