在使用 scikit-learn 中的 GroupKFold 方法时,我收到一条错误消息,鉴于文档,我无法理解。
错误信息是:
ValueError: too many values to unpack (expected 2)
该文档指出:
对于一个可重现的例子:
from sklearn.model_selection import GroupKFold
X1 = np.random.randint(1, 10, size = (100, 2))
groups1 = np.random.choice([1,2,3, 4, 5], size = 100, p = [.15, .2, .3, .15, .2])
gkf1 = GroupKFold(5)
train, test = gkf1.split(X = X1, groups = groups1 )
这会产生以下错误消息:
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-56-911681dea183> in <module>
8 gkf1 = GroupKFold(5)
9
---> 10 train, test = gkf1.split(X = X1, groups = groups1 )
ValueError: too many values to unpack (expected 2)