gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-11-30 09:59:13 24 4
gpt4 key购买 nike

此 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

谁能解释一下这个现象吗?

最佳答案

我从 this 中发现了这一点文档链接。默认情况下 verbose_eval = True 会导致打印日志。

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

关于python - XGBoost 在终端和笔记本上运行两次,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59693139/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com