【发布时间】:2021-06-29 13:16:51
【问题描述】:
我对我的数据进行了训练测试拆分,并为其拟合了支持向量机。
xtrain, xtest, ytrain, ytest = train_test_split(df, target)
svc = svm.SVC(C=30, gamma='auto')
svc.fit(xtrain,ytrain)
svc.score(xtest,ytest)
我正在将 SVC 模型拟合到 iris 数据集,每次运行 train_test_split 都会得到不同的结果(这很明显)。
是否有 train test_test_split 的任何属性或函数或任何其他方式,以便在得到结果后(执行上述代码后)我可以找出我得到结果的random_state 的值是多少?
【问题讨论】:
-
你不能优化
random_state;见Is random state a parameter to tune? -
谢谢你,我得到了答案
标签: python machine-learning scikit-learn grid-search hyperparameters