XGBoost在终端和笔记本上运行两次

问题描述 投票:0回答:1

此XGBoost代码运行两次

#https://towardsdatascience.com/running-xgboost-on-google-colab-free-gpu-a-case-study-841c90fef101

num_folds = 3
cv = StratifiedKFold(n_splits=num_folds, random_state =seed)
param_grid = {
        'classifier__max_depth': [3],
        'classifier__n_estimators': [200]
    }

gs3 = GridSearchCV(pipeline, param_grid, cv = cv, scoring = 'roc_auc', n_jobs = -1,\
                  verbose = False, return_train_score = True, refit = True)

fit_params={"classifier__early_stopping_rounds": 20, 
            "classifier__eval_metric" : ["error","auc"],
#             "classifier__verbose_eval" : 10,
            "classifier__eval_set" : [[X_train, y_train],[X_test, y_test]]}

%time gs3 = gs3.fit(X_train, y_train, **fit_params)
print(("best score from grid search: %.3f"
       % gs3.best_score_))

首先它将在终端上输出enter image description here

然后它将再次在笔记本电脑上运行enter image description here

有人可以解释这种现象吗?

python machine-learning jupyter-notebook data-science xgboost
1个回答
0
投票

我从this文档链接中了解了这一点。 verbose_eval =默认情况下为True,这将使其打印日志。

这些在训练后打印的日志是因为我们已经传递了Early_stopping_rounds的参数。

© www.soinside.com 2019 - 2024. All rights reserved.