python - Jupyter Notebook 中的 GridSearchCV 进展

标签 python machine-learning jupyter-notebook xgboost gridsearchcv

是否可以在 Jupyter Notebook 中看到 GridSearchCV 的进度?我正在 python 中运行这个脚本:

param_grid = {'learning_rate': [0.05, 0.10, 0.15, 0.20, 0.25, 0.30] ,
'max_depth'        : [3, 4, 5, 6, 8, 10, 12, 15],
'min_child_weight' : [1, 3, 5, 7],
'gamma'            : [0.0, 0.1, 0.2 , 0.3, 0.4],
'colsample_bytree' : [0.3, 0.4, 0.5 , 0.7],
'verbose'          : [100] }

xgboost_reg = XGBRegressor()
grid_search = GridSearchCV(xgboost_reg, param_grid, cv=5, scoring='neg_mean_squared_error', return_train_score=True)
grid_search.fit(my_data, my_labels, verbose=False)

我只能在单元格的输出中看到一些警告。

最佳答案

您需要verbose参数:

grid_search = GridSearchCV(xgboost_reg, param_grid, cv=5, scoring='neg_mean_squared_error', return_train_score=True, verbose=2)
grid_search.fit(my_data, my_labels, verbose=False)

我从玩具数据中获得的示例:

Fitting 3 folds for each of 5 candidates, totalling 15 fits
[CV] C=0.1 ...........................................................
[CV] ............................................ C=0.1, total=   0.0s
[CV] C=0.1 ...........................................................
[CV] ............................................ C=0.1, total=   0.0s
[CV] C=0.1 ...........................................................
[CV] ............................................ C=0.1, total=   0.0s
[CV] C=0.5 ...........................................................
[CV] ............................................ C=0.5, total=   0.0s
[CV] C=0.5 ...........................................................
[CV] ............................................ C=0.5, total=   0.0s
[CV] C=0.5 ...........................................................
[CV] ............................................ C=0.5, total=   0.0s

关于python - Jupyter Notebook 中的 GridSearchCV 进展,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56495946/

相关文章:

python - 提取列中的嵌套元素并存储到新列中

python - 为什么我的重新训练模型的准确性很差?

python - 如何正确卸载python jupyter?

python - Jupyter笔记本: module not found even after pip install

python - 在后台执行子进程

python - ._meta 的逆得到反向 FK 类

python - Scrapy:先删除导出文件中的数据,再写入内容

python - 如何在pytorch中使用反向传播和自定义损失?

python - 如何在python和NLTK中计算预测概率?

python - Jenkins 和监控工件(如 jupyter 笔记本)