小编spe*_*tre的帖子

与目标“binary:logistic”一起使用的默认评估指标已从“error”更改为“logloss”

在使用 optuna 进行超参数调整后,我尝试将 XGBClassifier 适合我的数据集,但我不断收到此警告:

与目标“binary:logistic”一起使用的默认评估指标从“error”更改为“logloss”

下面是我的代码:

#XGBC MODEL
model = XGBClassifier(random_state = 69)

cross_rfc_score = -1 * cross_val_score(model, train_x1, train_y,
                           cv = 5, n_jobs = -1, scoring = 'neg_mean_squared_error')
base_rfc_score = cross_rfc_score.mean()
Run Code Online (Sandbox Code Playgroud)

但如果我使用 Optuna 然后拟合获得的参数,它会给我警告。下面是代码:

def objective(trial):
    learning_rate = trial.suggest_float('learning_rate', 0.001, 0.01)
    n_estimators = trial.suggest_int('n_estimators', 10, 500)
    sub_sample = trial.suggest_float('sub_sample', 0.0, 1.0)
    max_depth = trial.suggest_int('max_depth', 1, 20)

    params = {'max_depth' : max_depth,
           'n_estimators' : n_estimators,
           'sub_sample' : sub_sample,
           'learning_rate' : learning_rate}

    model.set_params(**params)

    return np.mean(-1 * cross_val_score(model, train_x1, train_y,
                            cv …
Run Code Online (Sandbox Code Playgroud)

mse xgboost optuna

10
推荐指数
1
解决办法
9995
查看次数

标签 统计

mse ×1

optuna ×1

xgboost ×1