【发布时间】:2021-10-10 06:08:10
【问题描述】:
为什么我的sklearn.model_selection.train_test_split() 每次运行代码时都会返回相同的X_train、X_test、y_train、y_test 样本,即使我保留了shuffle=True,并且我没有手动定义种子值?
我正在打印这样的样本:
X_train, X_test, y_train, y_test = train_test_split(x, y, test_size = 0.3, random_state = 100, shuffle=True)
print (y_test)
【问题讨论】:
-
你正在强制一个特定的随机状态。去掉它,你会得到不同的结果
-
啊,我太傻了,谢谢!能否请您发表您的评论和答案,我可以将其作为解决方案。
标签: python machine-learning keras train-test-split