import numpy as np
from sklearn.cross_validation import train_test_split as tts
a = np.array([[1,2,3,4,5]]).T
b = np.array([[100,200,50,60,3000]]).T
x1,x2,y1,y2 = tts(a,b, test_size=0.2, shuffle=False)
print(x1)
print(x2)
print(y1)
print(y2)
我总是收到以下错误:
builtins.TypeError: Invalid parameters passed: {'shuffle': False}
我检查了文档:
shuffle : boolean, optional (default=True) Whether or not to shuffle the data before splitting. If shuffle=False then stratify must be None.
添加了stratify=None,但我仍然得到同样的错误。知道如何解决这个问题吗?
请您参考如下方法:
这是由 sklearn 的过时版本引起的。文档引用版本 0.19.0。当前安装的sklearn版本可以通过输入
>>> print(sklearn.__version__)
