在 Jupyter Notebook 中查看 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

Related Posts

如何从数据集中移除EXIF数据?

我在尝试从数据集中的图像中移除EXIF数据(这些数据将…

用于Python中的“智能点”游戏的遗传算法不工作

过去几天我一直在尝试实现所谓的“智能点”游戏。我第一次…

哪个R平方得分更有帮助?

data.drop(‘Movie Title’, ax…

使用线性回归预测GRE分数对录取率的影响

我正在学习线性回归,并尝试在Jupyter笔记本中用P…

使用mlrMBO贝叶斯优化进行SVM超参数调优时出现错误

我试图针对一个分类任务优化SVM,这个方法在许多其他模…

Keras模型的二元交叉熵准确率未发生变化

我在网上看到了很多关于这个问题的提问,但没有找到明确的…

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注