我使用以下方法找到了最佳参数和最佳分数网格搜索简历 and 随机搜索CV对于我的 TCSVM 模型。
现在我想用贝叶斯搜索CV为了与以前的方法进行比较,但我得到了这个错误__init__() got an unexpected keyword argument 'iid'
这是我使用的代码:
model2 = make_pipeline(StandardScaler(), SVC())
parameter_grid = {
'C': Real(1e-5, 1e+3, prior='log-uniform'),
'gamma': Real(2e-2, 2e+3, prior='log-uniform'),
'degree': Integer(1, 8),
'kernel': Categorical(['linear', 'poly', 'rbf']),
}
grid_searchdt = BayesSearchCV(estimator=model2, search_spaces=parameter_grid, n_iter=32, cv=5, random_state=0,
iid=True)
grid_searchdt.fit(X_Train, Y_Train)
grid_searchdt.score(X_Test, Y_Test)
print("Score opt =", grid_searchdt.score(X_Test, Y_Test))
print("Best_Params =", grid_searchdt.best_params_)
print("Best_Score =", grid_searchdt.best_score_)
我读到一些解决方案说我需要降级 scikit-learn 版本,但它对我不起作用。
请任何解决方案。