我正在尝试使用 BayesSearchCV,但出现意外错误。我不使用 iid 参数,但错误一直说__init__() got an unexpected keyword argument 'iid'
。我将在这里分享我的代码。
代码:
roc_auc = make_scorer(roc_auc_score, greater_is_better=True, needs_threshold=True)
skf = StratifiedKFold(n_splits=5, shuffle=True, random_state=1234)
clf = CatBoostClassifier(thread_count=2,
loss_function='Logloss',
od_type = 'Iter',
verbose= False
)
# Defining your search space
search_spaces = {'iterations': Integer(10, 1000),
'depth': Integer(1, 8),
'learning_rate': Real(0.01, 1.0, 'log-uniform'),
'random_strength': Real(1e-9, 10, 'log-uniform'),
'bagging_temperature': Real(0.0, 1.0),
'border_count': Integer(1, 255),
'l2_leaf_reg': Integer(2, 30),
'scale_pos_weight':Real(0.01, 1.0, 'uniform')}
# Setting up BayesSearchCV
opt = BayesSearchCV(clf,
search_spaces,
scoring=roc_auc,
cv=skf,
n_iter=100,
n_jobs=1, # use just 1 job with CatBoost in order to avoid segmentation fault
return_train_score=False,
refit=True,
optimizer_kwargs={'base_estimator': 'GP'}
)
错误信息: