我试图弄清楚我对嵌套交叉验证的理解是否正确,因此我写了这个玩具示例来看看我是否正确: import operator import numpy as np from sklearn import cross_validation from sklearn import ensemble from sklearn.datasets import load_boston # set random state state = 1 # load boston dataset boston = load_boston() X = boston.data y = boston.target outer_scores = [] # outer cross-validation outer = cross_validation.KFold(len(y), n_folds=3, shuffle=True, …