我正在尝试使用 CatBoostClassifier 调整多分类的超参数,但低于错误。
ValueError: multiclass format is not supported
我的目标变量包含 (0,1,2,3)
请检查我已实现的以下代码。
accuracy = make_scorer(accuracy_score, greater_is_better=True, needs_threshold=True)
skf = StratifiedKFold(n_splits=5, shuffle=True, random_state=42)
clf = CatBoostClassifier(thread_count=2, loss_function='MultiClass', eval_metric='Accuracy', leaf_estimation_method='Newton', od_type = 'Iter', verbose= False)
# Defining your search space
search_spaces = {'iterations': Integer(10, 2000),
'depth': Integer(1, 12),
'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)}
# Setting up BayesSearchCV
opt = BayesSearchCV(clf,
search_spaces,
scoring=accuracy,
cv=skf,
n_iter=100,
n_jobs=1,
return_train_score=False,
refit=True,
optimizer_kwargs={'base_estimator': 'GP'},
random_state=42)
opt.fit(X_train, y_train)
如果需要有关我的问题的更多详细信息,请告诉我。请帮我解决这个问题。谢谢!