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

Python XGBoost在终端和笔记本上运行两次,python,machine-learning,jupyter-notebook,data-science,xgboost,Python,Machine Learning,Jupyter Notebook,Data Science,Xgboost,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],

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_))
首先,它将在终端上输出

然后它会在笔记本上再次运行

有人能解释一下这种现象吗?

我从文档链接中找到了答案。默认情况下,verbose_eval=True,这会导致它打印日志

培训结束后打印的这些日志是因为我们已经通过了提前停止轮的参数