4

当我使用 lightgbm 进行网格搜索时,我遇到了麻烦。

lgb_classifer = lgb.LGBMRegressor(random_state=12)

grid_lgb = {
    'learning_rate': [0.01,0.05],
    'num_iterations': [5,10,20]}

gbm_lgb = GridSearchCV(estimator =lgb_classifer, param_grid =grid_lgb, scoring = 'recall', cv=3)

---> gbm_lgb.fit(X_train, y_train)

ValueError: Classification metrics can't handle a mix of binary and continuous targets

X_trainAND都是。y_train_ 是二进制标签。arrayy_train

4

1 回答 1

2

啊,我需要再看一眼。但如果它不是评论中链接的问题的重复,那么问题可能是您定义和训练回归模型(lgb.LGBMRegressor),而您的变量名称以及所选指标表明存在分类问题。尝试将模型更改为lgb.LGBMClassifier

于 2018-06-24T16:15:46.397 回答