本文介绍了声称“随机播放"是model_selection.train_test_split的无效参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
因此,当我尝试运行以下代码时出现的代码:
So when I try to run some code featuring the line below:
X_train, X_test, Y_train, Y_test=train_test_split(X_features, Y_feature, test_size=0.2, random_state=42, stratify=None, shuffle=False)
我收到以下错误:
TypeError: Invalid parameters passed: {'shuffle': False}
Yet, the 'shuffle' parameter is listed on scikitlearn website (http://scikit-learn.org/stable/modules/generated/sklearn.model_selection.train_test_split.html).
我尝试了不同的参数顺序,分别拆分了X和Y,但是没有结果.还有什么其他方法可以防止train_test_split将数据随机化吗?
I tried different order for parameters, splitting X and Y separately, but that yielded no result. Is there any other way I could prevent train_test_split from randomizing the data?
推荐答案
Shuffle已在0.19中引入,您可能使用的是0.18或更早版本的使用了不同的API .
Shuffle has been introduced in 0.19, you are probably using 0.18 or older which was following different API.
这篇关于声称“随机播放"是model_selection.train_test_split的无效参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!