【发布时间】:2021-08-04 03:48:51
【问题描述】:
我在 python 3.8.5 和 sklearn 0.24.1 上使用 GridSearchCV 运行参数网格:
grid_search = GridSearchCV(estimator=xg_clf, scoring=make_scorer(matthews_corrcoef), param_grid=param_grid, n_jobs=args.n_jobs, verbose = 3)
根据文档,
| verbose : int
| Controls the verbosity: the higher, the more messages.
|
| - >1 : the computation time for each fold and parameter candidate is
| displayed;
| - >2 : the score is also displayed;
| - >3 : the fold and candidate parameter indexes are also displayed
| together with the starting time of the computation.
设置verbose = 3,我做了,应该打印每次运行的马修斯相关系数。
但是,输出是
Fitting 5 folds for each of 480 candidates, totalling 2400 fits
[CV 1/5] END colsample_bytree=0.8, gamma=0, learning_rate=0.7, max_depth=3, n_estimators=200, subsample=0.9; total time= 0.2s
[CV 2/5] END colsample_bytree=0.8, gamma=0, learning_rate=0.7, max_depth=3, n_estimators=200, subsample=0.9; total time= 0.2s
[CV 3/5] END colsample_bytree=0.8, gamma=0, learning_rate=0.7, max_depth=3, n_estimators=200, subsample=0.9; total time= 0.2s
[CV 4/5] END colsample_bytree=0.8, gamma=0, learning_rate=0.7, max_depth=3, n_estimators=200, subsample=0.9; total time= 0.2s
[CV 5/5] END colsample_bytree=0.8, gamma=0, learning_rate=0.7, max_depth=3, n_estimators=200, subsample=0.9; total time= 0.2s
[CV 1/5] END colsample_bytree=0.8, gamma=0, learning_rate=0.7, max_depth=3, n_estimators=200, subsample=0.95; total time= 0.2s
为什么GridSearchCV 不为每次运行打印 MCC?
也许这是因为我使用了非标准的记分员?
【问题讨论】:
-
你在 Google Colab 上工作吗?此外,请确保更新您的库以匹配您引用的文档。
-
@ArturoSbr 我从未听说过 Google Colab。文档来自我笔记本电脑上的命令行。
-
我提到了 Google Colab,因为它是一个冗长的平台似乎不能很好地工作。无论哪种方式,
xg_clf是 xgboost 对象吗?如果是这样,那可能就是原因。 -
@ArturoSbr
xg_clf确实是一个 XGBoost 对象。 XGBoost 可以与 GridSearchCV 一起使用吗?
标签: python-3.x machine-learning scikit-learn