python中的StratifiedKFold给出了错误

时间:2017-05-26 22:50:30

标签: python scikit-learn

在python中我正在导入

>>> from sklearn.model_selection import StratifiedKFold

>>> cv = StratifiedKFold(y, n_folds=5)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: __init__() got an unexpected keyword argument 'n_folds'

>>> print('The sklearn version is {}.'.format(sklearn.__version__))
The sklearn version is 0.18.1.

我有sklearn 0.18.1。知道为什么我会收到这个错误吗?

1 个答案:

答案 0 :(得分:0)

折叠次数参数为n_splits,而不是n_folds

请参阅: http://scikit-learn.org/stable/modules/generated/sklearn.model_selection.StratifiedKFold.html